def get_client_username(request: AxesHttpRequest, credentials: dict = None) -> str:
if settings.AXES_USERNAME_CALLABLE:<EOL><INDENT>log.debug('<STR_LIT>')<EOL>if callable(settings.AXES_USERNAME_CALLABLE):<EOL><INDENT>return settings.AXES_USERNAME_CALLABLE(request, credentials)<EOL><DEDENT>if isinstance(settings.AXES_USERNAME_CALLABLE, str):<EOL><INDENT>return import_string(settings.AXES_USERNAME_CALLABLE)(request, credentials)<EOL><DEDENT>raise TypeError('<STR_LIT>')<EOL><DEDENT>if credentials:<EOL><INDENT>log.debug('<STR_LIT>')<EOL>return credentials.get(settings.AXES_USERNAME_FORM_FIELD, None)<EOL><DEDENT>log.debug('<STR_LIT>')<EOL>return request.POST.get(settings.AXES_USERNAME_FORM_FIELD, None)<EOL>
Resolve client username from the given request or credentials if supplied.

The order of preference for fetching the username is as follows:

1. If configured, use ``AXES_USERNAME_CALLABLE``, and supply ``request, credentials`` as arguments
2. If given, use ``credentials`` and fetch username from ``AXES_USERNAME_FORM_FIELD`` (defaults to ``username``)
3. Use request.POST and fetch username from ``AXES_USERNAME_FORM_FIELD`` (defaults to ``username``)

:param request: incoming Django ``HttpRequest`` or similar object from authentication backend or other source
:param credentials: incoming credentials ``dict`` or similar object from authentication backend or other source