code: def tofrequency(self, rf, v0, rfq):
          
          if is_measure(rfq) and rfq['type'] == 'frequency':
              rfq = dq.quantity(rfq['m0'])
          elif isinstance(rfq, str):
              rfq = dq.quantity(rfq)
          if is_measure(v0) and v0['type'] == 'doppler' \
                  and dq.is_quantity(rfq) \
                  and rfq.conforms(dq.quantity('Hz')):
              return self.doptofreq(v0, rf, rfq)
          else:
              raise TypeError('Illegal Doppler or rest frequency specified')
docs: Convert a Doppler type value (e.g. in radio mode) to a
          frequency. The type of frequency (e.g. LSRK) and a rest frequency
          (either as a frequency quantity (e.g. ``dm.constants('HI'))`` or
          a frequency measure (e.g. ``dm.frequency('rest','5100MHz'))`` should
          be specified.
  
          :param rf: frequency reference code (see :meth:`frequency`)
          :param v0: a doppler measure
          :param rfq: frequency measure or quantity
  
          Example::
  
              dop = dm.doppler('radio',0.4)
              freq = dm.tofrequency('lsrk', dop, dm.constants('HI'))