def token_create(self, label=None, expiry=None, scopes=None, **kwargs):
if label:<EOL><INDENT>kwargs['<STR_LIT:label>'] = label<EOL><DEDENT>if expiry:<EOL><INDENT>if isinstance(expiry, datetime):<EOL><INDENT>expiry = datetime.strftime(expiry, "<STR_LIT>")<EOL><DEDENT>kwargs['<STR_LIT>'] = expiry<EOL><DEDENT>if scopes:<EOL><INDENT>kwargs['<STR_LIT>'] = scopes<EOL><DEDENT>result = self.client.post('<STR_LIT>', data=kwargs)<EOL>if not '<STR_LIT:id>' in result:<EOL><INDENT>raise UnexpectedResponseError('<STR_LIT>'<EOL>'<STR_LIT>', json=result)<EOL><DEDENT>token = PersonalAccessToken(self.client, result['<STR_LIT:id>'], result)<EOL>return token<EOL>
Creates and returns a new Personal Access Token