def sanitize(url, config):
if url.scheme not in ("<STR_LIT>", "<STR_LIT>", "<STR_LIT>"):<EOL><INDENT>raise ValueError("<STR_LIT>" % (url.scheme,))<EOL><DEDENT>process = subprocess.Popen(<EOL>(<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>url.geturl().replace('<STR_LIT>', '<STR_LIT>'),<EOL>),<EOL>stdout=subprocess.PIPE,<EOL>)<EOL>sanitize_value_line = None<EOL>current_table = None<EOL>current_table_columns = None<EOL>for line in io.TextIOWrapper(process.stdout, encoding="<STR_LIT:utf-8>"):<EOL><INDENT>line = line.rstrip("<STR_LIT:\n>")<EOL>if current_table:<EOL><INDENT>if line == "<STR_LIT>":<EOL><INDENT>current_table = None<EOL>current_table_columns = None<EOL>yield "<STR_LIT>"<EOL>continue<EOL><DEDENT>if not sanitize_value_line:<EOL><INDENT>yield line<EOL>continue<EOL><DEDENT>yield sanitize_value_line(line)<EOL>continue<EOL><DEDENT>copy_line_match = COPY_LINE_PATTERN.match(line)<EOL>if not copy_line_match:<EOL><INDENT>yield line<EOL>continue<EOL><DEDENT>current_table = copy_line_match.group("<STR_LIT>")<EOL>current_table_columns = parse_column_names(copy_line_match.group("<STR_LIT>"))<EOL>sanitize_value_line = get_value_line_sanitizer(<EOL>config, current_table, current_table_columns)<EOL>yield line<EOL><DEDENT>
Obtains dump of an Postgres database by executing `pg_dump` command and
sanitizes it's output.

:param url: URL to the database which is going to be sanitized, parsed by
            Python's URL parser.
:type url: six.moves.urllib.parse.ParseResult

:param config: Optional sanitizer configuration to be used for sanitation
               of the values stored in the database.
:type config: database_sanitizer.config.Configuration|None