:param name:     str of name for the account, defaults to the created timestamp
        :param user_ids: list of int of users to give access to this account defaults to current user
        :return:         Account dict created
480019
def put(self, name=None, user_ids=None):
        
        return self.connection.put('account', data=dict(name=name, user_ids=user_ids))
9544
def newlogins(sessions):
    
    if not sessions:
        return [], []
    users = {}
    dates = {}

    for session in sessions:
        user = session.user
        # time value is discarded to aggregate on days only
        date = session.started_at.strftime("%Y/%m/%d")
        # keep the info only it's the first time we encounter a user
        if user not in users:
            users[user] = date
            # build the list of users on a given day
            if date not in dates:
                dates[date] = [user]
            else:
                dates[date].append(user)

    data = []
    total = []
    previous = 0
    for date in sorted(dates.keys()):
        # print u"{} : {}".format(date, len(dates[date]))
        date_epoch = unix_time_millis(datetime.strptime(date, "%Y/%m/%d"))
        data.append({"x": date_epoch, "y": len(dates[date])})
        previous += len(dates[date])
        total.append({"x": date_epoch, "y": previous})

    return data, total
816031
def get_user_id_by_user(self, username):
        '''  '''
        response, status_code = self.__pod__.Users.get_v2_user(
            sessionToken=self.__session__,
            username=username
        ).result()
        self.logger.debug('%s: %s' % (status_code, response))
        return status_code, response
75384
def _resolve_user_group_names(opts):
    '''
    
    '''
    name_id_opts = {'uid': 'user.info',
                    'gid': 'group.info'}
    for ind, opt in enumerate(opts):
        if opt.split('=')[0] in name_id_opts:
            _givenid = opt.split('=')[1]
            _param = opt.split('=')[0]
            _id = _givenid
            if not re.match('[0-9]+$', _givenid):
                _info = __salt__[name_id_opts[_param]](_givenid)
                if _info and _param in _info:
                    _id = _info[_param]
            opts[ind] = _param + '=' + six.text_type(_id)
        opts[ind] = opts[ind].replace('\\040', '\\ ')
    return opts
527750
def get_account_from_name(self, name):
        
        for account in self.accounts:
            if account.get_name() == name:
                return account
        return None
389225
def get_users_info(self, usernames):
        
        retval = {username: None for username in usernames}
        remaining_users = usernames

        infos = self._database.users.find({"username": {"$in": remaining_users}})
        for info in infos:
            retval[info["username"]] = (info["realname"], info["email"])

        return retval
1019846
def get_user(self, username):
        
        try:
            return self.users[username]
        except Exception as e:
            raise UserDoesntExist(username, self.backend_name)
1064838
def list_accounts_add(self, id, account_ids):
        
        id = self.__unpack_id(id)
        
        if not isinstance(account_ids, list):
            account_ids = [account_ids]
        account_ids = list(map(lambda x: self.__unpack_id(x), account_ids))
        
        params = self.__generate_params(locals(), ['id'])        
        self.__api_request('POST', '/api/v1/lists/{0}/accounts'.format(id), params)
678695
def get_account_entitlements_batch(self, user_ids):
        
        route_values = {}
        route_values['action'] = 'GetUsersEntitlements'
        content = self._serialize.body(user_ids, '[str]')
        response = self._send(http_method='POST',
                              location_id='cc3a0130-78ad-4a00-b1ca-49bef42f4656',
                              version='5.0-preview.1',
                              route_values=route_values,
                              content=content)
        return self._deserialize('[AccountEntitlement]', self._unwrap_collection(response))
1194517
def lookup_handles(ids):
    
    names = set()
    for id_list in [ids[100 * i:100 * i + 100] for i in range(len(ids))]:
        if len(id_list) > 0:
            while True:
                r = twapi.request('users/lookup', {'user_id': ','.join([str(i) for i in id_list])})
                if r.status_code in [88, 130, 420, 429]:  # rate limit
                    sys.stderr.write('Sleeping off rate limit for %s: %s\n' % (str(id_list), r.text))
                    time.sleep(301)
                elif r.status_code == 200:
                    for item in r.get_iterator():
                        names.add((item['screen_name'], item['id_str']))
                    break
                else:
                    sys.stderr.write('Error: %s\nSkipping %s...\n' % (str(id_list), r.text))
                    break

    return names
705505
def get_user(self, id, **data):
        
        
        return self.get("/users/{0}/".format(id), data=data)
12787
def get_user(self, user_id):
        
        api = self._get_api(iam.AccountAdminApi)
        return User(api.get_user(user_id))
1296772
def for_user(cls, user):
        
        user_id = getattr(user, api_settings.USER_ID_FIELD)
        if not isinstance(user_id, int):
            user_id = str(user_id)

        token = cls()
        token[api_settings.USER_ID_CLAIM] = user_id

        return token
1090612
def read_since_ids(users):
    
    since_ids = {}
    for user in users:
        if config.has_option(SECTIONS['INCREMENTS'], user):
            since_ids[user] = config.getint(SECTIONS['INCREMENTS'], user) + 1
    return since_ids
467697
def user_identities(self, user_id, **kwargs):
        ""
        api_path = "/api/v2/users/{user_id}/identities.json"
        api_path = api_path.format(user_id=user_id)
        return self.call(api_path, **kwargs)
1368929
def user_name(self, user_id):
        """"""
        user = self.users.get(user_id)

        if user is None:
            return "Unknown user ({})".format(user_id)

        return user["name"]
224459
def user(self, username=None):
        
        if username is None:
            username = self.__getUsername()

        url = "%s/%s" % (self.root, username)
        return User(url=url,
                    securityHandler=self._securityHandler,
                    proxy_url=self._proxy_url,
                    proxy_port=self._proxy_port,
                    initalize=True)