code: def ping(host, port=80, url=None, https=False, timeout=1, max_size=65535, sequence=0):
      
      try:
          result = scan(host=host, port=port, url=url, https=https, timeout=timeout, max_size=max_size)
      except ScanFailed as failure:
          result = failure.result
          result['error'] = True
          result['error_message'] = str(failure)
      result_obj = PingResponse(
          host=host, port=port, ip=result.get('ip', None), sequence=sequence,
          durations=result.get('durations', None),
          code=result.get('code', None),
          state=result.get('state', 'unknown'),
          length=result.get('length', 0),
          response=result.get('response', None),
          error=result.get('error', False),
          error_message=result.get('error_message', None),
          responding=True if result.get('state', 'unknown') in ['open'] else False,
          start=datetime.datetime.now(),
          end=datetime.datetime.now() + result['durations'].get('all', datetime.timedelta(0)) if result.get('durations', None) else None
      )
      return result_obj
docs: Ping a host
  
      Parameters
      ----------
      host: str
          The host or ip address to ping
  
      port: int, optional
          The port to ping, default=80
  
      url: str, optional
          URL to ping, will do a host/port ping if not provided
  
      https: bool, optional
          Connect via ssl, default=False
  
      timeout: int, optional
          Number of seconds to wait for a response before timing out, default=1 second
  
      max_size: int, optional
          The max size of response that can be retrieved.  This should be a power of 2
          default=65535.
  
      sequence: int, optional
          Sequence number for the ping request
  
      Returns
      -------
      PingResponse:
          The ping response object