<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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):
 """ Create a new resource. :param resource_type: string representing the a HydroShare resource type recognized by this server. :param title: string representing the title of the new resource :param resource_file: a read-only binary file-like object (i.e. opened with the flag 'rb') or a string representing path to file to be uploaded as part of the new resource :param resource_filename: string representing the filename of the resource file. Must be specified if resource_file is a file-like object. If resource_file is a string representing a valid file path, and resource_filename is not specified, resource_filename will be equal to os.path.basename(resource_file). is a string :param abstract: string representing abstract of resource :param keywords: list of strings representing keywords to associate with the resource :param edit_users: list of HydroShare usernames who will be given edit permissions :param view_users: list of HydroShare usernames who will be given view permissions :param edit_groups: list of HydroShare group names that will be given edit permissions :param view_groups: list of HydroShare group names that will be given view permissions :param metadata: json string data for each of the metadata elements :param extra_metadata: json string data for key/value pair metadata elements defined by user :param progress_callback: user-defined function to provide feedback to the user about the progress of the upload of resource_file. For more information, see: http://toolbelt.readthedocs.org/en/latest/uploading-data.html#monitoring-your-streaming-multipart-upload :return: string representing ID of newly created resource. :raises: HydroShareArgumentException if any parameters are invalid. :raises: HydroShareNotAuthorized if user is not authorized to perform action. :raises: HydroShareHTTPException if an unexpected HTTP response code is encountered. """

        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])))

        # Prepare request
        params = {'resource_type': resource_type, 'title': title}
        if abstract:
            params['abstract'] = abstract
        if keywords:
            # Put keywords in a format that django-rest's serializer will understand
            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