def extract_row_and_col_mappings(
    grades_headers, grades_file_contents, master_repo_names
):
    """Extract mappings from username -> row_nr and master_repo_name ->
    col_nr.
    """
    master_repo_to_col_nr = {
        repo_name: grades_headers.index(repo_name)
        for repo_name in master_repo_names
    }
    username_col = grades_headers.index("username")
    username_to_row_nr = {
        row[username_col]: i for i, row in enumerate(grades_file_contents)
    }
    return username_to_row_nr, master_repo_to_col_nr