Edit a document.

def edit(self, entity, id, payload, sync=True):
        """ Edit a document. """
        url = urljoin(self.host, entity.value + '/')
        url = urljoin(url, id + '/')
        params = {'sync': str(sync).lower()}
        url = Utils.add_url_parameters(url, params)
        r = requests.put(url, auth=self.auth, data=json.dumps(payload),
                         headers=self.headers)
        if r.status_code == 500:
            error_message = r.json()['error_message']
            raise CoredataError('Error! {error}'.format(error=error_message))