code: def update_metadata(self, href=None, metadata=None, version=None):
          
  
          # Argument error checking.
          assert href is not None
          assert metadata is not None
          assert version is None or isinstance(version, int)
  
          # Prepare the data we're going to include in our bundle update.
          data = None
  
          fields = {}
          if version is not None:
              fields['version'] = version
          fields['data'] = json.dumps(metadata)
  
          data = fields
  
          raw_result = self.put(href, data)
  
          if raw_result.status < 200 or raw_result.status > 202:
              raise APIException(raw_result.status, raw_result.json)
  
          # Convert the JSON to a python data struct.
  
          return self._parse_json(raw_result.json)
docs: Update the metadata in a bundle.
  
          'href' the relative href to the metadata. May not be None.
          'metadata' may be None, or an object that can be converted to a
          JSON string.  See API documentation for restrictions.  The
          conversion will take place before the API call.
          'version' the object version.  May be None; if not None, must be
          an integer, and the version must match the version of the
          bundle.  If not, a 409 conflict error will cause an APIException
          to be thrown.
  
          Returns a data structure equivalent to the JSON returned by the API.
  
          If the response status is not 2xx, throws an APIException.
          If the JSON to python data struct conversion fails, throws an
          APIDataException.