def METHOD_NAME(scopes, prefixes):
    scopes = [scope for scope in scopes for prefix in prefixes if scope.startswith(prefix)]
    _check_scopes_exist_and_all_have_the_same_prefix(scopes, prefixes)
    return scopes