code: def convert_if_not(cls, phases_or_groups):
      
      if isinstance(phases_or_groups, PhaseGroup):
        return mutablerecords.CopyRecord(phases_or_groups)
  
      flattened = flatten_phases_and_groups(phases_or_groups)
      return cls(main=flattened)
docs: Convert list of phases or groups into a new PhaseGroup if not already.