'Back-end method to create roles with ACLs
@param role: display name for the role
@param description: description of the role (optional)
@param acls: list of initial ACLs to assign to this role
@param args: keyword arguments (see below)
@keyword name: a unique name for the role
@keyword hidden: hide this role completely from the RoleManager
@keyword system: role can be assigned, but neither modified nor
deleted in the RoleManager
@keyword protected: role can be assigned and edited, but not
deleted in the RoleManager'

def s3_create_role(self, role, description=None, *acls, **args):

    table = self.settings.table_group
    hidden = args.get('hidden')
    system = args.get('system')
    protected = args.get('protected')
    if isinstance(description, dict):
        acls = ([description] + acls)
        description = None
    uid = args.get('uid', None)
    if uid:
        record = current.db((table.uuid == uid)).select(table.id, limitby=(0, 1)).first()
    else:
        record = None
        uid = uuid4()
    system_data = {}
    if (hidden is not None):
        system_data['hidden'] = hidden
    if (protected is not None):
        system_data['protected'] = protected
    if (system is not None):
        system_data['system'] = system
    if record:
        role_id = record.id
        record.update_record(deleted=False, role=role, description=description, **system_data)
    else:
        role_id = table.insert(uuid=uid, role=role, description=description, **system_data)
    if role_id:
        update_acl = self.permission.update_acl
        for acl in acls:
            update_acl(role_id, **acl)
    return role_id
