Create token.

def create_token(user):
    """
    Create token.
    """
    payload = jwt_payload_handler(user)
    if api_settings.JWT_ALLOW_REFRESH:
        payload['orig_iat'] = timegm(
            datetime.utcnow().utctimetuple()
        )

    # Return values
    token = jwt_encode_handler(payload)
    return token