code: def to_lal_unit(aunit):
      
      if isinstance(aunit, string_types):
          aunit = units.Unit(aunit)
      aunit = aunit.decompose()
      lunit = lal.Unit()
      for base, power in zip(aunit.bases, aunit.powers):
          # try this base
          try:
              lalbase = LAL_UNIT_FROM_ASTROPY[base]
          except KeyError:
              lalbase = None
              # otherwise loop through the equivalent bases
              for eqbase in base.find_equivalent_units():
                  try:
                      lalbase = LAL_UNIT_FROM_ASTROPY[eqbase]
                  except KeyError:
                      continue
          # if we didn't find anything, raise an exception
          if lalbase is None:
              raise ValueError("LAL has no unit corresponding to %r" % base)
          lunit *= lalbase ** power
      return lunit
docs: Convert the input unit into a `LALUnit`
  
      For example::
  
         >>> u = to_lal_unit('m**2 / kg ** 4')
         >>> print(u)
         m^2 kg^-4
  
      Parameters
      ----------
      aunit : `~astropy.units.Unit`, `str`
          the input unit
  
      Returns
      -------
      unit : `LALUnit`
          the LALUnit representation of the input
  
      Raises
      ------
      ValueError
          if LAL doesn't understand the base units for the input