class_docstr: The `User` class is used to manage users in Argilla. It provides methods to
  create new users, list all the users, get a user by its name or ID, and delete it.
  While it's not allowed to update the user information for the moment.
  
  Args:
      name: the name of the user to be managed. Defaults to None.
      id: the ID of the user to be managed. Defaults to None.
  
  Attributes:
      _client: the `httpx.Client` initialized to interact with the Argilla API.
      id: the ID of the user.
      username: the username of the user.
      first_name: the first name of the user.
      last_name: the last name of the user. Defaults to None.
      full_name: the full name of the user. Defaults to None.
      role: the role of the user.
      api_key: the API key of the user.
      inserted_at: the datetime when the user was created.
      updated_at: the datetime when the user was last updated.
  
  Examples:
      >>> from argilla import rg
      >>> user = rg.User.from_name("my-user") # or `User.from_id("...")`
      >>> print(user)
      User(id='...', username='my-user', role='annotator', first_name='Luke', last_name="Skywalker', full_name='Luke Skywalker', role='annotator', api_key='...', inserted_at=datetime.datetime(2021, 8, 31, 10, 0, 0), updated_at=datetime.datetime(2021, 8, 31, 10, 0, 0))
class_docstr_tok: ["The","`","User","`","class","is","used","to","manage","users","in","Argilla",".","It","provides","methods","to","create","new","users",",","list","all","the","users",",","get","a","user","by","its","name","or","ID",",","and","delete","it",".","While","it","'s","not","allowed","to","update","the","user","information","for","the","moment",".","Args",":","name",":","the","name","of","the","user","to","be","managed",".","Defaults","to","None",".","id",":","the","ID","of","the","user","to","be","managed",".","Defaults","to","None",".","Attributes",":","_client",":","the","`","httpx.Client","`","initialized","to","interact","with","the","Argilla","API",".","id",":","the","ID","of","the","user",".","username",":","the","username","of","the","user",".","first_name",":","the","first","name","of","the","user",".","last_name",":","the","last","name","of","the","user",".","Defaults","to","None",".","full_name",":","the","full","name","of","the","user",".","Defaults","to","None",".","role",":","the","role","of","the","user",".","api_key",":","the","API","key","of","the","user",".","inserted_at",":","the","datetime","when","the","user","was","created",".","updated_at",":","the","datetime","when","the","user","was","last","updated",".","Examples",":",">",">",">","from","argilla","import","rg",">",">",">","user","=","rg.User.from_name","(","``","my-user","''",")","#","or","`","User.from_id","(","``","...","''",")","`",">",">",">","print","(","user",")","User","(","id=","'","...","'",",","username='my-user","'",",","role='annotator","'",",","first_name='Luke","'",",","last_name=","''","Skywalker","'",",","full_name='Luke","Skywalker","'",",","role='annotator","'",",","api_key=","'","...","'",",","inserted_at=datetime.datetime","(","2021",",","8",",","31",",","10",",","0",",","0",")",",","updated_at=datetime.datetime","(","2021",",","8",",","31",",","10",",","0",",","0",")",")"]
docstr: Creates a new user in Argilla.
  
  Args:
      username: the username of the user to be created.
      password: the password of the user to be created.
      first_name: the first name of the user to be created. Defaults to None.
      last_name: the last name of the user to be created. Defaults to None.
      role: the role of the user to be created. Defaults to None.
      workspaces: a list of workspace names the user to be created is linked to. Defaults to None.
  
  Returns:
      A new `User` instance.
  
  Raises:
      KeyError: if the user already exists in Argilla.
      ValueError: if the provided parameters are not valid.
      RuntimeError: if the user cannot be created in Argilla.
  
  Examples:
      >>> from argilla import rg
      >>> user = rg.User.create("my-user", "my-password", role="admin")
docstr_tok: ["Creates","a","new","user","in","Argilla",".","Args",":","username",":","the","username","of","the","user","to","be","created",".","password",":","the","password","of","the","user","to","be","created",".","first_name",":","the","first","name","of","the","user","to","be","created",".","Defaults","to","None",".","last_name",":","the","last","name","of","the","user","to","be","created",".","Defaults","to","None",".","role",":","the","role","of","the","user","to","be","created",".","Defaults","to","None",".","workspaces",":","a","list","of","workspace","names","the","user","to","be","created","is","linked","to",".","Defaults","to","None",".","Returns",":","A","new","`","User","`","instance",".","Raises",":","KeyError",":","if","the","user","already","exists","in","Argilla",".","ValueError",":","if","the","provided","parameters","are","not","valid",".","RuntimeError",":","if","the","user","can","not","be","created","in","Argilla",".","Examples",":",">",">",">","from","argilla","import","rg",">",">",">","user","=","rg.User.create","(","``","my-user","''",",","``","my-password","''",",","role=","''","admin","''",")"]
code: def create(
      cls,
      username: str,
      password: str,
      *,
      first_name: Optional[str] = None,
      last_name: Optional[str] = None,
      role: Optional[UserRole] = None,
      workspaces: Optional[List[str]] = None,
  ) -> "User":
      """Creates a new user in Argilla.
  
      Args:
          username: the username of the user to be created.
          password: the password of the user to be created.
          first_name: the first name of the user to be created. Defaults to None.
          last_name: the last name of the user to be created. Defaults to None.
          role: the role of the user to be created. Defaults to None.
          workspaces: a list of workspace names the user to be created is linked to. Defaults to None.
  
      Returns:
          A new `User` instance.
  
      Raises:
          KeyError: if the user already exists in Argilla.
          ValueError: if the provided parameters are not valid.
          RuntimeError: if the user cannot be created in Argilla.
  
      Examples:
          >>> from argilla import rg
          >>> user = rg.User.create("my-user", "my-password", role="admin")
      """
      if not first_name:
          warnings.warn(
              "Since the `first_name` hasn't been provided, it will be set to the same value as the `username`."
          )
          first_name = username
      if not role:
          warnings.warn(
              "Since the `role` hasn't been provided, it will be set to `annotator`."
          )
          role = UserRole.annotator
  
      client = cls.__active_client()
      try:
          user = users_api.create_user(
              client,
              username=username,
              password=password,
              first_name=first_name,
              last_name=last_name,
              role=role,
              workspaces=workspaces,
          ).parsed
          return cls.__new_instance(client, user)
      except AlreadyExistsApiError as e:
          raise KeyError(
              f"User with username=`{username}` already exists in Argilla, so please"
              " make sure that the name you provided is a unique one."
          ) from e
      except ValidationApiError as e:
          response = e.ctx["response"]
          raise ValueError(
              f"User with username=`{username}` cannot be created in Argilla, as"
              f" the provided data is not valid. Please, check the following error: {response}"
          ) from e
      except BaseClientError as e:
          raise RuntimeError(
              f"Error while creating user with username=`{username}` in Argilla."
          ) from e
  
imports: import warnings
  from datetime import datetime
  from typing import TYPE_CHECKING, Iterator, List, Optional, Union
  from uuid import UUID
  from argilla.client.sdk.commons.errors import AlreadyExistsApiError, BaseClientError, NotFoundApiError, ValidationApiError
  from argilla.client.sdk.users import api
  from argilla.client.sdk.users.models import UserModel, UserRole
  from argilla.client.sdk.v1.users import api
  from argilla.client.sdk.v1.workspaces import api
  from argilla.client.singleton import active_client
  from argilla.client.utils import allowed_for_roles
label_desc: Use image node_id 10 for calling the User obj's underlying member method code with example usage: obj.create(cls, username, password) and returns: cls