'Output the unit in the given format as a string.
The physical unit is appended, within parentheses, to the function
unit, as in "dB(mW)", with both units set using the given format
Parameters
format : `astropy.units.format.Base` instance or str
The name of a format or a formatter object.  If not
provided, defaults to the generic format.'

def to_string(self, format=u'generic'):

    if (format not in (u'generic', u'unscaled', u'latex')):
        raise ValueError(u"Function    units    cannot    be    written    in    {0}    format.    Only    'generic',    'unscaled'    and    'latex'    are    supported.".format(format))
    self_str = self.function_unit.to_string(format)
    pu_str = self.physical_unit.to_string(format)
    if (pu_str == u''):
        pu_str = u'1'
    if (format == u'latex'):
        self_str += u'$\\mathrm{{\\left(    {0}    \\right)}}$'.format(pu_str[1:(-1)])
    else:
        self_str += u'({0})'.format(pu_str)
    return self_str
