'Create a new issue and return an issue Resource for it.
Each keyword argument (other than the predefined ones) is treated as a field name and the argument\'s value
is treated as the intended value for that field -- if the fields argument is used, all other keyword arguments
will be ignored.
By default, the client will immediately reload the issue Resource created by this method in order to return
a complete Issue object to the caller; this behavior can be controlled through the \'prefetch\' argument.
JIRA projects may contain many different issue types. Some issue screens have different requirements for
fields in a new issue. This information is available through the \'createmeta\' method. Further examples are
available here: https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API+Example+-+Create+Issue
:param fields: a dict containing field names and the values to use. If present, all other keyword arguments
will be ignored
:param prefetch: whether to reload the created issue Resource so that all of its data is present in the value
returned from this method'

def create_issue(self, fields=None, prefetch=True, **fieldargs):

    data = _field_worker(fields, **fieldargs)
    p = data[u'fields'][u'project']
    if (isinstance(p, string_types) or isinstance(p, integer_types)):
        data[u'fields'][u'project'] = {u'id': self.project(p).id}
    p = data[u'fields'][u'issuetype']
    if isinstance(p, integer_types):
        data[u'fields'][u'issuetype'] = {u'id': p}
    if (isinstance(p, string_types) or isinstance(p, integer_types)):
        data[u'fields'][u'issuetype'] = {u'id': self.issue_type_by_name(p).id}
    url = self._get_url(u'issue')
    r = self._session.post(url, data=json.dumps(data))
    raw_issue_json = json_loads(r)
    if (u'key' not in raw_issue_json):
        raise JIRAError(r.status_code, response=r, url=url, text=json.dumps(data))
    if prefetch:
        return self.issue(raw_issue_json[u'key'])
    else:
        return Issue(self._options, self._session, raw=raw_issue_json)
