<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def wrap(self, main_phases, name=None):
 """Returns PhaseGroup with additional main phases."""

    new_main = list(self.main)
    if isinstance(main_phases, collections.Iterable):
      new_main.extend(main_phases)
    else:
      new_main.append(main_phases)
    return PhaseGroup(
        setup=self.setup,
        main=new_main,
        teardown=self.teardown,
        name=name)