def METHOD_NAME(name):
    """Requests issues from GitHub API and writes to CSV file."""
    url = f"https://api.github.com/repos/{name}/issues?state=all"
    if token is not None:
        headers = {"Authorization": "token " + token}
    else:
        headers = None
    r = requests.get(url, headers=headers)
    csvfilename = f"{name.replace('/', '-')}-issues.csv"
    with open(csvfilename, "w", newline="") as csvfile:
        csvout = csv.writer(csvfile)
        csvout.writerow(
            [
                "Title",
                "Number",
                "URL",
                "State",
                "Assignee",
                "Milestone",
                "Priority",
                "Severity",
                "Weight",
                "Labels",
            ]
        )
        write_issues(r, csvout)
        # Multiple requests are required if response is paged
        if "link" in r.headers:
            pages = {
                rel[6:-1]: url[url.index("<") + 1 : -1]
                for url, rel in (
                    link.split(";") for link in r.headers["link"].split(",")
                )
            }
            while "last" in pages and "next" in pages:
                pages = {
                    rel[6:-1]: url[url.index("<") + 1 : -1]
                    for url, rel in (
                        link.split(";") for link in r.headers["link"].split(",")
                    )
                }
                r = requests.get(pages["next"], headers=headers)
                write_issues(r, csvout)
                if pages["next"] == pages["last"]:
                    break