:calls: `PUT /repos/:owner/:repo/branches/:branch/protection <https://developer.github.com/v3/repos/branches>`_
        :strict: bool
        :contexts: list of strings
        :enforce_admins: bool
        :dismissal_users: list of strings
        :dismissal_teams: list of strings
        :dismiss_stale_reviews: bool
        :require_code_owner_reviews: bool
        :required_approving_review_count: int
        :user_push_restrictions: list of strings
        :team_push_restrictions: list of strings

        NOTE: The GitHub API groups strict and contexts together, both must
        be submitted. Take care to pass both as arguments even if only one is
        changing. Use edit_required_status_checks() to avoid this.

def edit_protection(self, strict=github.GithubObject.NotSet, contexts=github.GithubObject.NotSet, enforce_admins=github.GithubObject.NotSet, dismissal_users=github.GithubObject.NotSet, dismissal_teams=github.GithubObject.NotSet, dismiss_stale_reviews=github.GithubObject.NotSet, require_code_owner_reviews=github.GithubObject.NotSet, required_approving_review_count=github.GithubObject.NotSet, user_push_restrictions=github.GithubObject.NotSet, team_push_restrictions=github.GithubObject.NotSet):
        """
        :calls: `PUT /repos/:owner/:repo/branches/:branch/protection <https://developer.github.com/v3/repos/branches>`_
        :strict: bool
        :contexts: list of strings
        :enforce_admins: bool
        :dismissal_users: list of strings
        :dismissal_teams: list of strings
        :dismiss_stale_reviews: bool
        :require_code_owner_reviews: bool
        :required_approving_review_count: int
        :user_push_restrictions: list of strings
        :team_push_restrictions: list of strings

        NOTE: The GitHub API groups strict and contexts together, both must
        be submitted. Take care to pass both as arguments even if only one is
        changing. Use edit_required_status_checks() to avoid this.
        """
        assert strict is github.GithubObject.NotSet or isinstance(strict, bool), strict
        assert contexts is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) or isinstance(element, (str, unicode)) for element in contexts), contexts
        assert enforce_admins is github.GithubObject.NotSet or isinstance(enforce_admins, bool), enforce_admins
        assert dismissal_users is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) or isinstance(element, (str, unicode)) for element in dismissal_users), dismissal_users
        assert dismissal_teams is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) or isinstance(element, (str, unicode)) for element in dismissal_teams), dismissal_teams
        assert dismiss_stale_reviews is github.GithubObject.NotSet or isinstance(dismiss_stale_reviews, bool), dismiss_stale_reviews
        assert require_code_owner_reviews is github.GithubObject.NotSet or isinstance(require_code_owner_reviews, bool), require_code_owner_reviews
        assert required_approving_review_count is github.GithubObject.NotSet or isinstance(required_approving_review_count, int), required_approving_review_count

        post_parameters = {}
        if strict is not github.GithubObject.NotSet or contexts is not github.GithubObject.NotSet:
            if strict is github.GithubObject.NotSet:
                strict = False
            if contexts is github.GithubObject.NotSet:
                contexts = []
            post_parameters["required_status_checks"] = {"strict": strict, "contexts": contexts}
        else:
            post_parameters["required_status_checks"] = None

        if enforce_admins is not github.GithubObject.NotSet:
            post_parameters["enforce_admins"] = enforce_admins
        else:
            post_parameters["enforce_admins"] = None

        if dismissal_users is not github.GithubObject.NotSet or dismissal_teams is not github.GithubObject.NotSet or dismiss_stale_reviews is not github.GithubObject.NotSet or require_code_owner_reviews is not github.GithubObject.NotSet or required_approving_review_count is not github.GithubObject.NotSet:
            post_parameters["required_pull_request_reviews"] = {}
            if dismiss_stale_reviews is not github.GithubObject.NotSet:
                post_parameters["required_pull_request_reviews"]["dismiss_stale_reviews"] = dismiss_stale_reviews
            if require_code_owner_reviews is not github.GithubObject.NotSet:
                post_parameters["required_pull_request_reviews"]["require_code_owner_reviews"] = require_code_owner_reviews
            if required_approving_review_count is not github.GithubObject.NotSet:
                post_parameters["required_pull_request_reviews"]["required_approving_review_count"] = required_approving_review_count
            if dismissal_users is not github.GithubObject.NotSet:
                post_parameters["required_pull_request_reviews"]["dismissal_restrictions"] = {"users": dismissal_users}
            if dismissal_teams is not github.GithubObject.NotSet:
                if "dismissal_restrictions" not in post_parameters["required_pull_request_reviews"]:
                    post_parameters["required_pull_request_reviews"]["dismissal_restrictions"] = {}
                post_parameters["required_pull_request_reviews"]["dismissal_restrictions"]["teams"] = dismissal_teams
        else:
            post_parameters["required_pull_request_reviews"] = None
        if user_push_restrictions is not github.GithubObject.NotSet or team_push_restrictions is not github.GithubObject.NotSet:
            if user_push_restrictions is github.GithubObject.NotSet:
                user_push_restrictions = []
            if team_push_restrictions is github.GithubObject.NotSet:
                team_push_restrictions = []
            post_parameters["restrictions"] = {"users": user_push_restrictions, "teams": team_push_restrictions}
        else:
            post_parameters["restrictions"] = None

        headers, data = self._requester.requestJsonAndCheck(
            "PUT",
            self.protection_url,
            headers={'Accept': Consts.mediaTypeRequireMultipleApprovingReviews},
            input=post_parameters
        )