docs: def scansearch(auth, label, filt, project=None, aid=None):
      '''
      Search for scans by supplying a set of SQL-based conditionals.
  
      Example:
          >>> import yaxil
          >>> auth = yaxil.XnatAuth(url='...', username='...', password='...')
          >>> query = {
          ...   'eor1': "note LIKE %EOR1%",
          ...   'eor2': "note LIKE %EOR2%",
          ...   'mpr':  "series_description='T1_MEMPRAGE RMS' OR note LIKE %ANAT%"
          ... }
          >>> yaxil.scansearch(auth, 'AB1234C', query)
          {"mpr": [4], "eor1": [13], "eor2": [14]}
  
      :param auth: XNAT authentication object
      :type auth: :mod:`yaxil.XnatAuth`
      :param label: XNAT MR Session label
      :type label: str
      :param filt: Scan search filter/query
      :type filt: dict
      :param project: XNAT MR Session project
      :type project: str
      :param aid: XNAT Accession ID
      :type aid: str
      :returns: Same dictionary that was passed in, but values are now matching scans
      :rtype: dict
      '''
      if not aid:
          aid = accession(auth, label, project)
      # get scans for accession as a csv
      url = "%s/data/experiments/%s/scans?format=csv" % (auth.url.rstrip('/'), aid)
      logger.debug("issuing http request %s", url)
      r = requests.get(url, auth=(auth.username, auth.password), verify=CHECK_CERTIFICATE)
      if r.status_code != requests.codes.ok:
          raise ScanSearchError("response not ok (%s) from %s" % (r.status_code, r.url))
      if not r.content:
          raise ScanSearchError("response is empty from %s" % r.url)
      # read the result into a csv reader
      reader = csv.reader(io.StringIO(r.content.decode()))
      columns = next(reader)
      # create an in-memory database
      conn = sqlite3.connect(":memory:")
      c = conn.cursor()
      # create scans table and insert data
      c.execute("CREATE TABLE scans (%s)" % ','.join(columns))
      query = "INSERT INTO scans VALUES (%s)" % ','.join('?' * len(columns))
      for row in reader:
          c.execute(query, [x for x in row])
      conn.commit()
      # run the user supplied filters and return result
      result = col.defaultdict(list)
      for token,filt in iter(filt.items()):
          try:
              result[token] = [x[0] for x in c.execute("SELECT ID FROM scans where %s" % filt)]
          except sqlite3.OperationalError:
              logger.critical("something is wrong with the filter: %s", filt)
              raise
      return result