def get_and_check_project(valid_vcs_rules, source_url):
    """Given vcs rules and a source_url, return the project.

    The project is in the path, but is the repo name.
    `releases/mozilla-beta` is the path; `mozilla-beta` is the project.

    Args:
        valid_vcs_rules (tuple of frozendicts): the valid vcs rules, per
            ``match_url_regex``.
        source_url (str): the source url to find the project for.

    Raises:
        RuntimeError: on failure to find the project.

    Returns:
        str: the project.

    """
    project_path = match_url_regex(valid_vcs_rules, source_url, match_url_path_callback)
    if project_path is None:
        raise ValueError("Unknown repo for source url {}!".format(source_url))
    project = project_path.split('/')[-1]
    return project
Given vcs rules and a source_url, return the project.

    The project is in the path, but is the repo name.
    `releases/mozilla-beta` is the path; `mozilla-beta` is the project.

    Args:
        valid_vcs_rules (tuple of frozendicts): the valid vcs rules, per
            ``match_url_regex``.
        source_url (str): the source url to find the project for.

    Raises:
        RuntimeError: on failure to find the project.

    Returns:
        str: the project.