code: def load_urlencoded_body(handler):
      
      @wraps(handler)
      def wrapper(event, context):
          if isinstance(event.get('body'), str):
              try:
                  event['body'] = parse_qs(event['body'])
              except:
                  return {'statusCode': 400, 'body': 'BAD REQUEST'}
          return handler(event, context)
  
      return wrapper
docs: Automatically deserialize application/x-www-form-urlencoded bodies
  
      Automatically returns a 400 BAD REQUEST if there is an error while parsing.
  
      Usage::
  
        >>> from lambda_decorators import load_urlencoded_body
        >>> @load_urlencoded_body
        ... def handler(event, context):
        ...     return event['body']['foo']
        >>> handler({'body': 'foo=spam&bar=answer&bar=42'}, object())
        ['spam']
  
      note that ``event['body']`` is already a dictionary and didn't have to
      explicitly be parsed.