title: How do I return a custom message from an AWS Lambda Authorizer (python)?
body: <p>In lambda authorizer, the http status code returned for access denied, token expired etc are 403. 
  How do i return a message 'Token Expired' in case the Token Expires.</p>
  
  <p>context.fail method is not supported.
  Raise Exception only creates log in cloudwatch.</p>
  
  <pre class="lang-py prettyprint-override"><code>def lambda_handler(event, context):
      .
      .
      .
      # verify the signature
      claims = jwt.get_unverified_claims(token)
      if time.time() &gt; claims['exp']:
          print('Token is expired')
          return generatePolicy(claims['sub'], 'Deny', event['methodArn'])
      else:
      if(claims['cognito:groups'][0].lower()=='admin'):
          return generatePolicy(claims['sub'], 'Allow', event['methodArn'])
      else:
          return generatePolicy(claims['sub'], 'Deny', event['methodArn'])
      return claims
  </code></pre>