async def _get_user_id(self, user, *, asdict=False):
uid = self.config.user_id()<EOL>if isinstance(user, dict):<EOL><INDENT>user_id = user.get(uid)<EOL><DEDENT>elif hasattr(user, "<STR_LIT>"):<EOL><INDENT>_to_dict = await utils.call(user.to_dict)<EOL>user_id = _to_dict.get(uid)<EOL><DEDENT>else:<EOL><INDENT>raise exceptions.InvalidRetrieveUserObject()<EOL><DEDENT>if asdict:<EOL><INDENT>return {uid: user_id}<EOL><DEDENT>return user_id<EOL>
Get a user_id from a user object. If `asdict` is True, will return
it as a dict with `config.user_id` as key. The `asdict` keyword
defaults to `False`.