def METHOD_NAME(value):
    """
    Strips broken characters that can't be represented at all
    in utf8. This prevents our parsers from breaking elsewhere.
    """
    if isinstance(value, str):
        value = value.encode("utf8", errors="replace")
    if isinstance(value, bytes):
        value = value.decode("utf8", errors="replace")
    return value