async def _get_payload(self, user):
payload = await utils.call(self.build_payload, user)<EOL>if (<EOL>not isinstance(payload, dict)<EOL>or self.config.user_id() not in payload<EOL>):<EOL><INDENT>raise exceptions.InvalidPayload<EOL><DEDENT>payload = await utils.call(self.add_claims, payload, user)<EOL>extend_payload_args = inspect.getfullargspec(self.extend_payload)<EOL>args = [payload]<EOL>if "<STR_LIT:user>" in extend_payload_args.args:<EOL><INDENT>args.append(user)<EOL><DEDENT>payload = await utils.call(self.extend_payload, *args)<EOL>if self.config.scopes_enabled():<EOL><INDENT>scopes = await utils.call(self.add_scopes_to_payload, user)<EOL>if not isinstance(scopes, (tuple, list)):<EOL><INDENT>scopes = [scopes]<EOL><DEDENT>payload[self.config.scopes_name()] = scopes<EOL><DEDENT>claims = self.claims + [x.get_key() for x in self._custom_claims]<EOL>missing = [x for x in claims if x not in payload]<EOL>if missing:<EOL><INDENT>logger.debug("<STR_LIT>")<EOL>raise exceptions.MissingRegisteredClaim(missing=missing)<EOL><DEDENT>return payload<EOL>
Given a user object, create a payload and extend it as configured.