def METHOD_NAME(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,
    )