parameters: (project_id: int, allowed_roles: list, user_id: int)
return_statement: return len(user_membership) > 0
docstring: Given a project and permitted team roles, check user's membership in the team list
docstring_summary: Given a project and permitted team roles, check user's membership in the team list
docstring_tokens: Given a project and permitted team roles check user s membership in the team list
function: def check_team_membership(project_id: int, allowed_roles: list, user_id: int):
          """ Given a project and permitted team roles, check user's membership in the team list """
          teams_dto = TeamService.get_project_teams_as_dto(project_id)
          teams_allowed = [
              team_dto for team_dto in teams_dto.teams if team_dto.role in allowed_roles
          ]
          user_membership = [
              team_dto.team_id
              for team_dto in teams_allowed
              if TeamService.is_user_an_active_team_member(team_dto.team_id, user_id)
          ]
          return len(user_membership) > 0
function_tokens: def check_team_membership ( project_id : int , allowed_roles : list , user_id : int ) : teams_dto = TeamService . get_project_teams_as_dto ( project_id ) teams_allowed = [ team_dto for team_dto in teams_dto . teams if team_dto . role in allowed_roles ] user_membership = [ team_dto . team_id for team_dto in teams_allowed if TeamService . is_user_an_active_team_member ( team_dto . team_id , user_id ) ] return len ( user_membership ) > 0