code: def get_client_ip(environ):
      # type: (Dict[str, str]) -> Optional[Any]
      
      try:
          return environ["HTTP_X_FORWARDED_FOR"].split(",")[0].strip()
      except (KeyError, IndexError):
          pass
  
      try:
          return environ["HTTP_X_REAL_IP"]
      except KeyError:
          pass
  
      return environ.get("REMOTE_ADDR")
docs: Infer the user IP address from various headers. This cannot be used in
      security sensitive situations since the value may be forged from a client,
      but it's good enough for the event payload.