(s, encoding=DEFAULT_ENCODING, errors='ignore')
return s
Return a byte-string version of 's', encoded as specified in 'encoding'.
Return a byte-string version of 's', encoded as specified in 'encoding'.
Return a byte - string version of s encoded as specified in encoding .
def smart_str(s, encoding=DEFAULT_ENCODING, errors='ignore'):
    """
    Return a byte-string version of 's', encoded as specified in 'encoding'.
    """
    if isinstance(s, unicode):
        return s.encode(encoding, errors)

    # Already a byte-string, nothing to do here
    if isinstance(s, str):
        return s

    return s
def smart_str ( s , encoding = DEFAULT_ENCODING , errors = 'ignore' ) : if isinstance ( s , unicode ) : return s . encode ( encoding , errors ) # Already a byte-string, nothing to do here if isinstance ( s , str ) : return s return s