@public<EOL>def check_repo_teams(repo, allow_teams, deny_teams, team_names=None):
assert isinstance(repo, github.Repository.Repository), type(repo)<EOL>if not team_names:<EOL><INDENT>try:<EOL><INDENT>team_names = [t.name for t in repo.get_teams()]<EOL><DEDENT>except github.RateLimitExceededException:<EOL><INDENT>raise<EOL><DEDENT>except github.GithubException as e:<EOL><INDENT>msg = '<STR_LIT>'<EOL>raise CaughtRepositoryError(repo, e, msg) from None<EOL><DEDENT><DEDENT>if not any(x in team_names for x in allow_teams)or any(x in team_names for x in deny_teams):<EOL><INDENT>raise RepositoryTeamMembershipError(<EOL>repo,<EOL>team_names,<EOL>allow_teams=allow_teams,<EOL>deny_teams=deny_teams<EOL>)<EOL><DEDENT>
Check if repo teams match allow/deny lists

    Parameters
    ----------
    repo: github.Repository.Repository
        repo to check for membership

    allow_teams: list(str)
        list of team names that repo MUST belong to at least one of.

    deny_teams: list(str)
        list of team that repo MUST NOT be a member of.

    team_names: list(str)
        list of the team name which the repo is a member of (optional).
        Providing this list saves retrieving the list of teams from the github
        API.

    Raises
    ------
    RepositoryTeamMembershipError
        Upon permission error