code: def create_token(user):
      
      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
docs: Create token.