from typing import Type
from typing import Optional


def _get_origin_py37(type_: Type) -> Optional[Type]:
    """typing.get_origin is introduced in Python 3.8, but we need a get_origin
    that is compatible with 3.7.

    Args:
        type_ (Type): A type.

    Returns:
        Type: The origin of `type_`.
    """
    # uses typing for types
    return type_.__origin__ if hasattr(type_, '__origin__') else None