Get the unsubscripted version of a type: for a typing object of the form X[Y, Z, ...] return X.
typing.get_origin(tp)
assert get_origin(str) is None
assert get_origin(Dict[str, int]) is dict
assert get_origin(Union[int, str]) is Union
P = ParamSpec('P')
assert get_origin(P.args) is P
assert get_origin(P.kwargs) is P