code: def createResource(self, resource_type, title, resource_file=None, resource_filename=None,
                         abstract=None, keywords=None,
                         edit_users=None, view_users=None, edit_groups=None, view_groups=None,
                         metadata=None, extra_metadata=None, progress_callback=None):
          url = "{url_base}/resource/".format(url_base=self.url_base)
          close_fd = False
          if resource_type not in self.resource_types:
              raise HydroShareArgumentException("Resource type {0} is not among known resources: {1}".format(resource_type,
                                                                                                             ", ".join([r for r in self.resource_types])))
          params = {'resource_type': resource_type, 'title': title}
          if abstract:
              params['abstract'] = abstract
          if keywords:
              for (i, kw) in enumerate(keywords):
                  key = "keywords[{index}]".format(index=i)
                  params[key] = kw
          if edit_users:
              params['edit_users'] = edit_users
          if view_users:
              params['view_users'] = view_users
          if edit_groups:
              params['edit_groups'] = edit_groups
          if view_groups:
              params['view_groups'] = view_groups
          if metadata:
              params['metadata'] = metadata
          if extra_metadata:
              params['extra_metadata'] = extra_metadata
          if resource_file:
              close_fd = self._prepareFileForUpload(params, resource_file, resource_filename)
          encoder = MultipartEncoder(params)
          if progress_callback is None:
              progress_callback = default_progress_callback
          monitor = MultipartEncoderMonitor(encoder, progress_callback)
          r = self._request('POST', url, data=monitor, headers={'Content-Type': monitor.content_type})
          if close_fd:
              fd = params['file'][1]
              fd.close()
          if r.status_code != 201:
              if r.status_code == 403:
                  raise HydroShareNotAuthorized(('POST', url))
              else:
                  raise HydroShareHTTPException((url, 'POST', r.status_code, params))
          response = r.json()
          new_resource_id = response['resource_id']
          return new_resource_id