docs: def cone_search(ra, dec, dra=0.01, ddec=0.01, mjdate=None, calibration_level=2, use_ssos=True,
                  collection='CFHTMEGAPIPE'):
      """Do a QUERY on the TAP service for all observations that are part of OSSOS (*P05/*P016)
      where taken after mjd and have calibration 'observable'.
  
      @param ra: RA center of search cont
      @type ra: Quantity
      @param dec: float degrees
      @type dec: Quantity
      @param dra: float degrees
      @type dra: Quantity
      @param ddec: float degrees
      @type ddec: Quantity
      @param calibration_level: What calibration level must the found image have,
      @param mjdate: what data must the observation be to
      @param collection: name of the data collection to be searched.
      @param use_ssos: USE the SSOIS server to find comparison?  False -> Use CAOM2 TAP query.
      ke on.
      this is a CAOM2 parameter of CADC, 2 means calibrated data.
      """
  
      if use_ssos:
          ssois_server = "http://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/cadcbin/ssos/fixedssos.pl"
          params = dict(pos="{0:f},{1:f}".format(ra.to(units.degree).value, dec.to(units.degree).value))
          result = requests.get(ssois_server, params=params)
          table = ascii.read(result.text, format='tab')
          table = table[table['Telescope/Instrument'] == 'CFHT/MegaCam']
          column_name_mapping = {'Image': 'collectionID',
                                 'Filter': 'filter',
                                 'Exptime': 'exptime'}
          # rename the columns
          for key in column_name_mapping:
              table[key].name = column_name_mapping[key]
          table['collectionID'] = [x[:-1] for x in table['collectionID']]
          # compute the mjdate from the time string.
          table['mjdate'] = Time(table['Date/Time']).mjd
          return table
  
      data = dict(QUERY=(" SELECT Observation.observationID as collectionID, "
                         " Plane.time_bounds_lower AS mjdate, "
                         " Plane.time_exposure AS exptime, "
                         " Plane.energy_bandpassName as filter"
                         " FROM caom2.Observation AS Observation "
                         " JOIN caom2.Plane AS Plane "
                         " ON Observation.obsID = Plane.obsID "
                         " WHERE  ( Observation.collection = '{}' ) "
                         " AND Plane.calibrationLevel > {} "
                         " AND ( Plane.energy_bandpassName LIKE 'r.%' OR Plane.energy_bandpassName LIKE 'gri.%' ) "
                         " AND ( Observation.proposal_id LIKE '%P05' or Observation.proposal_id LIKE '%P06' )"
                         " AND Observation.target_name NOT LIKE 'WP%'"),
                  REQUEST="doQuery",
                  LANG="ADQL",
                  FORMAT="tsv")
  
      data["QUERY"] = data["QUERY"].format(calibration_level, collection)
      data["QUERY"] += (" AND  "
                        " CONTAINS( BOX('ICRS', {}, {}, {}, {}), "
                        " Plane.position_bounds ) = 1 ").format(ra.to(units.degree).value, dec.to(units.degree).value,
                                                                dra.to(units.degree).value, ddec.to(units.degree).value)
      if mjdate is not None:
          data["QUERY"] += " AND Plane.time_bounds_lower < {} AND Plane.time_bounds_cval2 > {} ".format(
              mjdate + 1.0 / 24.0,
              mjdate - 1 / 24.0)
  
      result = requests.get(TAP_WEB_SERVICE, params=data, verify=False)
  
      logger.debug("Doing TAP Query using url: %s" % (str(result.url)))
  
      table_reader = ascii.get_reader(Reader=ascii.Basic)
      table_reader.header.splitter.delimiter = '\t'
      table_reader.data.splitter.delimiter = '\t'
      table = table_reader.read(result.text)
  
      logger.debug(str(table))
      return table