code: def protectbranch(self, project_id, branch):
          
          request = requests.put(
              '{0}/{1}/repository/branches/{2}/protect'.format(self.projects_url, project_id, branch),
              headers=self.headers, verify=self.verify_ssl, auth=self.auth, timeout=self.timeout)
  
          if request.status_code == 200:
              return True
          else:
              return False
docs: Protect a branch from changes
  
          :param project_id: project id
          :param branch: branch id
          :return: True if success