r"""Convert floating point `degrees` into a sexagesimal string.

    >>> _dstr(181.875)
    '181deg 52\' 30.0"'
    >>> _dstr(181.875, places=3)
    '181deg 52\' 30.000"'
    >>> _dstr(181.875, signed=True)
    '+181deg 52\' 30.0"'
    >>> _dstr(float('nan'))
    'nan'

def _dstr(degrees, places=1, signed=False):
    r"""Convert floating point `degrees` into a sexagesimal string.

    >>> _dstr(181.875)
    '181deg 52\' 30.0"'
    >>> _dstr(181.875, places=3)
    '181deg 52\' 30.000"'
    >>> _dstr(181.875, signed=True)
    '+181deg 52\' 30.0"'
    >>> _dstr(float('nan'))
    'nan'

    """
    if isnan(degrees):
        return 'nan'
    sgn, d, m, s, etc = _sexagesimalize_to_int(degrees, places)
    sign = '-' if sgn < 0.0 else '+' if signed else ''
    return '%s%02ddeg %02d\' %02d.%0*d"' % (sign, d, m, s, places, etc)