Create a project with the specified parameters.

        :param key: Mandatory. Must match JIRA project key requirements, usually only 2-10 uppercase characters.
        :type: str
        :param name: If not specified it will use the key value.
        :type name: Optional[str]
        :param assignee: If not specified it will use current user.
        :type assignee: Optional[str]
        :param type: Determines the type of project should be created.
        :type type: Optional[str]
        :param template_name: is used to create a project based on one of the existing project templates.
                If `template_name` is not specified, then it should use one of the default values.
        :type template_name: Optional[str]

        :return: Should evaluate to False if it fails otherwise it will be the new project id.
        :rtype: Union[bool,int]

def create_project(self, key, name=None, assignee=None, type="Software", template_name=None):
        """Create a project with the specified parameters.

        :param key: Mandatory. Must match JIRA project key requirements, usually only 2-10 uppercase characters.
        :type: str
        :param name: If not specified it will use the key value.
        :type name: Optional[str]
        :param assignee: If not specified it will use current user.
        :type assignee: Optional[str]
        :param type: Determines the type of project should be created.
        :type type: Optional[str]
        :param template_name: is used to create a project based on one of the existing project templates.
                If `template_name` is not specified, then it should use one of the default values.
        :type template_name: Optional[str]

        :return: Should evaluate to False if it fails otherwise it will be the new project id.
        :rtype: Union[bool,int]

        """
        if assignee is None:
            assignee = self.current_user()
        if name is None:
            name = key

        possible_templates = ['Basic', 'JIRA Classic', 'JIRA Default Schemes', 'Basic software development']

        if template_name is not None:
            possible_templates = [template_name]

        # https://confluence.atlassian.com/jirakb/creating-a-project-via-rest-based-on-jira-default-schemes-744325852.html
        templates = self.templates()
        # TODO(ssbarnea): find a better logic to pick a default fallback template
        template_key = list(templates.values())[0]['projectTemplateModuleCompleteKey']
        for template_name, template_dic in templates.items():
            if template_name in possible_templates:
                template_key = template_dic['projectTemplateModuleCompleteKey']
                break

        payload = {'name': name,
                   'key': key,
                   'keyEdited': 'false',
                   # 'projectTemplate': 'com.atlassian.jira-core-project-templates:jira-issuetracking',
                   # 'permissionScheme': '',
                   'projectTemplateWebItemKey': template_key,
                   'projectTemplateModuleKey': template_key,
                   'lead': assignee,
                   # 'assigneeType': '2',
                   }

        if self._version[0] > 6:
            # JIRA versions before 7 will throw an error if we specify type parameter
            payload['type'] = type

        headers = CaseInsensitiveDict(
            {'Content-Type': 'application/x-www-form-urlencoded'})
        url = self._options['server'] + \
            '/rest/project-templates/latest/templates'

        r = self._session.post(url, data=payload, headers=headers)

        if r.status_code == 200:
            r_json = json_loads(r)
            return r_json

        f = tempfile.NamedTemporaryFile(
            suffix='.html', prefix='python-jira-error-create-project-', delete=False)
        f.write(r.text)

        if self.logging:
            logging.error(
                "Unexpected result while running create project. Server response saved in %s for further investigation [HTTP response=%s]." % (
                    f.name, r.status_code))
        return False