'Creates the user in manageiq.
Returns:
the created user id, name, created_on timestamp,
updated_on timestamp, userid and current_group_id.'

def create_user(self, userid, name, group, password, email):

    for (key, value) in dict(name=name, group=group, password=password).items():
        if (value in (None, '')):
            self.module.fail_json(msg=('missing    required    argument:    %s' % key))
    group_id = self.group_id(group)
    url = ('%s/users' % self.api_url)
    resource = {'userid': userid, 'name': name, 'password': password, 'group': {'id': group_id}}
    if (email is not None):
        resource['email'] = email
    try:
        result = self.client.post(url, action='create', resource=resource)
    except Exception as e:
        self.module.fail_json(msg=('failed    to    create    user    %s:    %s' % (userid, str(e))))
    return dict(changed=True, msg=('successfully    created    the    user    %s:    %s' % (userid, result['results'])))
