def scale_timeseries_unit(tsunit, scaling='<STR_LIT>'):
<EOL>if scaling == '<STR_LIT>':<EOL><INDENT>baseunit = units.Hertz<EOL><DEDENT>elif scaling == '<STR_LIT>':<EOL><INDENT>baseunit = units.dimensionless_unscaled<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>" % scaling)<EOL><DEDENT>if tsunit:<EOL><INDENT>specunit = tsunit ** <NUM_LIT:2> / baseunit<EOL><DEDENT>else:<EOL><INDENT>specunit = baseunit ** -<NUM_LIT:1><EOL><DEDENT>return specunit<EOL>
Scale the unit of a `TimeSeries` to match that of a `FrequencySeries`

    Parameters
    ----------
    tsunit : `~astropy.units.UnitBase`
        input unit from `TimeSeries`
    scaling : `str`
        type of frequency series, either 'density' for a PSD, or
        'spectrum' for a power spectrum.

    Returns
    -------
    unit : `~astropy.units.Unit`
        unit to be applied to the resulting `FrequencySeries`.