def METHOD_NAME(
    sdist_directory: str, config_settings: Optional[Mapping[str, Any]] = None
) -> str:
    command = ["maturin", "pep517", "write-sdist", "--sdist-directory", sdist_directory]
    print("Running `{}`".format(" ".join(command)))
    sys.stdout.flush()
    result = subprocess.run(command, stdout=subprocess.PIPE)
    sys.stdout.buffer.write(result.stdout)
    sys.stdout.flush()
    if result.returncode != 0:
        sys.stderr.write(
            f"Error: command {command} returned non-zero exit status {result.returncode}\n"
        )
        sys.exit(1)
    output = result.stdout.decode(errors="replace")
    return output.strip().splitlines()[-1]