def sanitize(url, config):
    """
    Obtains dump of MySQL database by executing `mysqldump` command and
    sanitizes it output.

    :param url: URL to the database which is going to be sanitized, parsed by
                Python's URL parser.
    :type url: urllib.urlparse.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
    """
    if url.scheme != "mysql":
        raise ValueError("Unsupported database type: '%s'" % (url.scheme,))

    args, env = get_mysqldump_args_and_env_from_url(url=url)

    process = subprocess.Popen(
        args=["mysqldump"] + args,
        env=env,
        stdout=subprocess.PIPE,
    )

    return sanitize_from_stream(stream=process.stdout, config=config)