docs: def _check_with_socket(self, sock_info, metadata=None):
          """Return (IsMaster, round_trip_time).
  
          Can raise ConnectionFailure or OperationFailure.
          """
          cmd = SON([('ismaster', 1)])
          if metadata is not None:
              cmd['client'] = metadata
          start = _time()
          request_id, msg, max_doc_size = message.query(
              0, 'admin.$cmd', 0, -1, cmd,
              None, DEFAULT_CODEC_OPTIONS)
  
          # TODO: use sock_info.command()
          sock_info.send_message(msg, max_doc_size)
          raw_response = sock_info.receive_message(1, request_id)
          result = helpers._unpack_response(raw_response)
          return IsMaster(result['data'][0]), _time() - start