code: def input_to_phase(data, rate, data_type):
      
      if data_type == "phase":
          return data
      elif data_type == "freq":
          return frequency2phase(data, rate)
      else:
          raise Exception("unknown data_type: " + data_type)
docs: Take either phase or frequency as input and return phase