def METHOD_NAME(origin_name, arg_names):
    # Re-sugars typing.Union[T, NoneType] into typing.Optional[T] in case
    # that's what the origin and arg names refer to. Otherwise, returns the
    # data unchanged.
    if (origin_name == "typing.Union"
            and len(arg_names) == 2
            and arg_names[-1] == "NoneType"):
        origin_name = "typing.Optional"
        arg_names = arg_names[:1]
    return origin_name, arg_names