def parse_authors(response, paper_id):
    """Parse author information from a MAG API response.

    Args:
        response (json): Response from MAG API in JSON format. Contains all paper information.
        paper_id (int): Paper ID.

    Returns:
        authors (:obj:`list` of :obj:`dict`): List of dictionaries with author information.
            There's one dictionary per author.
        paper_with_authors (:obj:`list` of :obj:`dict`): Matching paper and author IDs.

    """
    authors = []
    paper_with_authors = []
    for author in response["AA"]:
        # mag_paper_authors
        paper_with_authors.append(
            {"paper_id": paper_id, "author_id": author["AuId"], "order": author["S"]}
        )
        # mag_authors
        authors.append({"id": author["AuId"], "name": author["DAuN"]})

    return authors, paper_with_authors