code: def ping():
      '''
      Ping?  Pong!
      '''
  
      dev = conn()
      # Check that the underlying netconf connection still exists.
      if dev._conn is None:
          return False
  
      # call rpc only if ncclient queue is empty. If not empty that means other
      # rpc call is going on.
      if hasattr(dev._conn, '_session'):
          if dev._conn._session._transport.is_active():
              # there is no on going rpc call. buffer tell can be 1 as it stores
              # remaining char after "]]>]]>" which can be a new line char
              if dev._conn._session._buffer.tell() <= 1 and \
                      dev._conn._session._q.empty():
                  return _rpc_file_list(dev)
              else:
                  log.debug('skipped ping() call as proxy already getting data')
                  return True
          else:
              # ssh connection is lost
              return False
      else:
          # other connection modes, like telnet
          return _rpc_file_list(devf ping():
      '''
      Ping?  Pong!
      '''
  
      dev = conn()
      # Check that the underlying netconf connection still exists.
      if dev._conn is None:
          return False
  
      # call rpc only if ncclient queue is empty. If not empty that means other
      # rpc call is going on.
      if hasattr(dev._conn, '_session'):
          if dev._conn._session._transport.is_active():
              # there is no on going rpc call. buffer tell can be 1 as it stores
              # remaining char after "]]>]]>" which can be a new line char
              if dev._conn._session._buffer.tell() <= 1 and \
                      dev._conn._session._q.empty():
                  return _rpc_file_list(dev)
              else:
                  log.debug('skipped ping() call as proxy already getting data')
                  return True
          else:
              # ssh connection is lost
              return False
      else:
          # other connection modes, like telnet
          return _rpc_file_list(dev)
docs: Ping?  Pong!