<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def string_decode(string, enc='ascii'):
 """ safely decodes string to unicode bytestring, respecting `enc` as a hint. :param string: the string to decode :type string: str or unicode :type enc: str :returns: the unicode decoded input string :rtype: unicode """


    if enc is None:
        enc = 'ascii'
    try:
        string = str(string, enc, errors='replace')
    except LookupError:  # malformed enc string
        string = string.decode('ascii', errors='replace')
    except TypeError:  # already str
        pass
    return string