def create_authorization_header(token_or_dict):
    """Create a Bearer Authorization header from token.

    Takes either a token_dict as returned by create_web_token or a token
    directly.
    """
    if isinstance(token_or_dict, dict):
        token = token_or_dict['token']
    else:
        token = token_or_dict

    if not isinstance(token, str):
        # PY2 jwt 2.0 (PY2 only) returns a string here
        # jwt 2.0 should be required if we drop PY2 support.
        token = token.decode('ascii')
    return ('Authorization', 'Bearer {}'.format(token))