<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def parse_unit(name, parse_strict='warn', format='gwpy'):
 """Attempt to intelligently parse a `str` as a `~astropy.units.Unit` Parameters name : `str` unit name to parse parse_strict : `str` one of 'silent', 'warn', or 'raise' depending on how pedantic you want the parser to be format : `~astropy.units.format.Base` the formatter class to use when parsing the unit string Returns ------- unit : `~astropy.units.UnitBase` the unit parsed by `~astropy.units.Unit` Raises ------ ValueError if the unit cannot be parsed and `parse_strict='raise'` """

    if name is None or isinstance(name, units.UnitBase):
        return name

    try:  # have we already identified this unit as unrecognised?
        return UNRECOGNIZED_UNITS[name]
    except KeyError:  # no, this is new
        # pylint: disable=unexpected-keyword-arg
        try:
            return units.Unit(name, parse_strict='raise')
        except ValueError as exc:
            if (parse_strict == 'raise' or
                    'did not parse as unit' not in str(exc)):
                raise
            # try again using out own lenient parser
            GWpyFormat.warn = parse_strict != 'silent'
            return units.Unit(name, parse_strict='silent', format=format)
        finally:
            GWpyFormat.warn = True