def create_account(self, account_type, account_name, email, expire_date,
            human_first_name, human_last_name, with_confirmation=True):
        """Create an account of the specified type.

        This is a convenience function to avoid duplicating some of the work.

        @type account_type: subclass of BaseVirtHomeAccount
        @param account_type: The account class type to use.

        @type account_name: str
        @param account_name: Account name to give the new account

        @type email: str
        @param email: The email address of the account owner

        @type expire_date: mx.DateTime.DateTime
        @param expire_date: The expire date for the account

        @type human_first_name: str
        @param human_first_name: The first name(s) of the account owner

        @type human_last_name: str
        @param human_last_name: The last name(s) of the account owner

        @type with_confirmation: bool
        @param with_confirmation: Controls whether a confirmation request
                                  should be issued for this account. In some
                                  situations it makes no sense to confirm
                                  anything.
                                  NOTE: The caller must dispatch any
                                  confirmation mail. This controls whether a
                                  confirmation event/code should be created and
                                  returned.
        @rtype: list [ BaseVirtHomeAccount, str ]
        @return: The newly created account, and the confirmation key needed to
                 confirm the given email address.
                 NOTE: If with_confirmation was False, the confirmation key
                 will be empty.
        """

        assert issubclass(account_type, BaseVirtHomeAccount)

        # Creation can still fail later, but hopefully this captures most
        # situations and produces a sensible account_name.
        if self.account_exists(account_name):
            raise CerebrumError("Account '%s' already exists" % account_name)

        account = account_type(self.db)
        account.populate(email, account_name, human_first_name,
                human_last_name, expire_date)
        account.write_db()
        account.populate_trait(self.co.trait_user_retained, numval=0) # Never exported to ldap
        account.write_db()

        self.assign_default_user_spreads(account)

        magic_key = ""
        if with_confirmation:
            magic_key = self.setup_event_request(
                account.entity_id,
                self.clconst.va_pending_create)

        return account, magic_key