def get_generic_bases(tp):
    """Get generic base types of a type or empty tuple if not possible.
    """
    org = getattr(tp, '__origin__', None)
    if org:
        a = (org,)
    else:
        a = ()
    return a + getattr(tp, "__orig_bases__", ())