code: def RZToplanarPotential(RZPot):
      
      RZPot= flatten(RZPot)
      if isinstance(RZPot,list):
          out= []
          for pot in RZPot:
              if isinstance(pot,planarPotential) and not pot.isNonAxi:
                  out.append(pot)
              elif isinstance(pot,Potential) and not pot.isNonAxi:
                  out.append(planarPotentialFromRZPotential(pot))
              else:
                  raise PotentialError("Input to 'RZToplanarPotential' is neither an RZPotential-instance or a list of such instances")
          return out
      elif isinstance(RZPot,Potential) and not RZPot.isNonAxi:
          return planarPotentialFromRZPotential(RZPot)
      elif isinstance(RZPot,planarPotential) and not RZPot.isNonAxi:
          return RZPot
      else:
          raise PotentialError("Input to 'RZToplanarPotential' is neither an RZPotential-instance or a list of such instances")
docs: NAME:
  
         RZToplanarPotential
  
      PURPOSE:
  
         convert an RZPotential to a planarPotential in the mid-plane (z=0)
  
      INPUT:
  
         RZPot - RZPotential instance or list of such instances (existing planarPotential instances are just copied to the output)
  
      OUTPUT:
  
         planarPotential instance(s)
  
      HISTORY:
  
         2010-07-13 - Written - Bovy (NYU)