def decode_and_filter(line: bytes, context: RunContext) -> typing.Optional[str]:
line_str: str = line.decode(context.console_encoding, errors='<STR_LIT:replace>')<EOL>filtered_line: typing.Optional[str] = filter_line(line_str, context)<EOL>if filtered_line:<EOL><INDENT>return filtered_line.rstrip()<EOL><DEDENT>return None<EOL>
Decodes a line that was captured from the running process using a given encoding (defaults to UTF8)

Runs that line into the filters, and output the decoded line back if no filter catches it.

:param line: line to parse
:type line: str
:param context: run context
:type context: RunContext
:return: optional line
:rtype: str