docstr: Creates an access token
  
  Parameters
  ----------
  username:
      The user name
  expires_delta:
      Token expiration
  
  Returns
  -------
      An access token string
docstr_tok: ["Creates","an","access","token","Parameters","--","--","--","--","--","username",":","The","user","name","expires_delta",":","Token","expiration","Returns","--","--","--","-","An","access","token","string"]
code: def _create_access_token(
      self, username: str, expires_delta: Optional[timedelta] = None
  ) -> str:
      """
      Creates an access token
  
      Parameters
      ----------
      username:
          The user name
      expires_delta:
          Token expiration
  
      Returns
      -------
          An access token string
      """
      to_encode = {"sub": username}
      if expires_delta:
          to_encode["exp"] = datetime.utcnow() + expires_delta
  
      return jwt.encode(
          to_encode,
          self.settings.secret_key,
          algorithm=self.settings.algorithm,
      )
  
file_path: argilla/src/argilla/server/security/auth_provider/db/provider.py
imports: from datetime import datetime, timedelta
  from typing import Optional
  from fastapi import Depends, FastAPI, Request
  from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm, SecurityScopes
  from jose import JWTError, jwt
  from sqlalchemy.ext.asyncio import AsyncSession
  from argilla.server.contexts import accounts
  from argilla.server.database import get_async_db
  from argilla.server.errors import UnauthorizedError
  from argilla.server.models import User
  from argilla.server.security.auth_provider.base import AuthProvider, api_key_header
  from argilla.server.security.model import Token
  from .settings import Settings
  from .settings import settings
label_desc: Use image node_id 4 for calling the DBAuthProvider obj's underlying member method code with example usage: obj._create_access_token(username, expires_delta) and returns: jwt