from typing import Union
from typing import List


def types_match(
    node_type: Union[str, List[str]], expected_type: Union[str, List[str]]
) -> bool:
    """Determine whether two jsonschema types match, accounting for types which are a
    list of types, or a single type
    """
    if type(node_type) != type(expected_type):
        return False

    if isinstance(expected_type, list):
        node_type = sorted(node_type)
        expected_type = sorted(expected_type)

    return node_type == expected_type