def to_lal_unit(aunit):
if isinstance(aunit, string_types):<EOL><INDENT>aunit = units.Unit(aunit)<EOL><DEDENT>aunit = aunit.decompose()<EOL>lunit = lal.Unit()<EOL>for base, power in zip(aunit.bases, aunit.powers):<EOL><INDENT>try:<EOL><INDENT>lalbase = LAL_UNIT_FROM_ASTROPY[base]<EOL><DEDENT>except KeyError:<EOL><INDENT>lalbase = None<EOL>for eqbase in base.find_equivalent_units():<EOL><INDENT>try:<EOL><INDENT>lalbase = LAL_UNIT_FROM_ASTROPY[eqbase]<EOL><DEDENT>except KeyError:<EOL><INDENT>continue<EOL><DEDENT><DEDENT><DEDENT>if lalbase is None:<EOL><INDENT>raise ValueError("<STR_LIT>" % base)<EOL><DEDENT>lunit *= lalbase ** power<EOL><DEDENT>return lunit<EOL>
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