- Use a private, static method. - Simplify the check for an empty sequence. - Remove redundant "None" check. - Use a "match" statement for the object type check.
- Use a private, static method. - Simplify the check for an empty sequence. - Remove redundant "None" check. - Use a "match" statement for the object type check.