<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def setAccessRules(self, pid, public=False):
 """ Set access rules for a resource. Current only allows for setting the public or private setting. :param pid: The HydroShare ID of the resource :param public: True if the resource should be made public. """

        url = "{url_base}/resource/accessRules/{pid}/".format(url_base=self.url_base,
                                                              pid=pid)
        params = {'public': public}

        r = self._request('PUT', url, data=params)
        if r.status_code != 200:
            if r.status_code == 403:
                raise HydroShareNotAuthorized(('PUT', url))
            elif r.status_code == 404:
                raise HydroShareNotFound((pid,))
            else:
                raise HydroShareHTTPException((url, 'PUT', r.status_code, params))

        resource = r.json()
        assert(resource['resource_id'] == pid)
        return resource['resource_id']