import typing


def get_origin(tp: typing.Any) -> typing.Any:
    """Get unsubscribed version of `tp`.

        get_origin(int) is None
        get_origin(typing.Any) is None
        get_origin(typing.List[int]) is list
        get_origin(typing.Literal[123]) is typing.Literal
        get_origin(typing.Generic[T]) is typing.Generic
        get_origin(typing.Generic) is typing.Generic
        get_origin(typing.Annotated[int, "some"]) is int

    NOTE: This method intentionally allows Annotated to proxy __origin__
    """
    if tp is typing.Generic:  # Special case
        return tp
    return getattr(tp, "__origin__", None)