code: def convert(input_format, output_format, data, one_spectrum=False):
      if input_format == output_format:
          return data
      if input_format not in from_converters:
          raise KeyError('Input format {0} not known!'.format(input_format))
      if output_format not in to_converters:
          raise KeyError('Output format {0} not known!'.format(output_format))
      if len(data.shape) == 2 and data.shape[0] == 2 and one_spectrum:
          work_data = np.hstack((data[0, :], data[1, :]))
          one_spec_2d = True
      else:
          work_data = data
          one_spec_2d = False
      cre, cim = from_converters[input_format](work_data)
      converted_data = to_converters[output_format](cre, cim)
      if one_spec_2d:
          part1, part2 = split_data(converted_data, True)
          converted_data = np.vstack((part1, part2))
      if len(data.shape) == 1:
          converted_data = np.squeeze(converted_data)
      return converted_data