def decode_input(s):
    'Given input string/bytes, decode according to stdin codepage (or UTF-8)\n    if not defined\n\n    If fails -- issue warning and decode allowing for errors\n    being replaced\n    '
    if isinstance(s, str):
        return s
    else:
        encoding = (sys.stdin.encoding or 'UTF-8')
        try:
            return s.decode(encoding)
        except UnicodeDecodeError as exc:
            lgr.warning('Failed to decode input string using %s encoding. Decoding allowing for errors', encoding)
            return s.decode(encoding, errors='replace')
Given input string/bytes, decode according to stdin codepage (or UTF-8)
if not defined

If fails -- issue warning and decode allowing for errors
being replaced
def decode_input(s):
    'Given input string/bytes, decode according to stdin codepage (or UTF-8)\n    if not defined\n\n    If fails -- issue warning and decode allowing for errors\n    being replaced\n    '
    if isinstance(s, str):
        return s
    else:
        encoding = (sys.stdin.encoding or 'UTF-8')
        try:
            return s.decode(encoding)
        except UnicodeDecodeError as exc:
            lgr.warning('Failed to decode input string using %s encoding. Decoding allowing for errors', encoding)
            return s.decode(encoding, errors='replace')