def get_token_details(token, tenant_id=None):
    try:
        token_id_driver = identity.token_id_driver()
        token_details = token_id_driver.token_from_id(token)
    except (__HOLE__, ValueError):
        raise exceptions.Unauthorized('Invalid Key')

    if time.time() > token_details['expires']:
        raise exceptions.Unauthorized('Expired Key')

    if tenant_id and str(token_details['tenant_id']) != tenant_id:
        raise exceptions.Unauthorized('Tenant/token Mismatch')

    return token_details
dataset/ETHPy150Open softlayer/jumpgate/jumpgate/common/sl/auth.py/get_token_details