def GetUsername(self, event, default_username='-'):
    """Retrieves the username related to the event.

    Args:
      event (EventObject): event.
      default_username (Optional[str]): default username.

    Returns:
      str: username.
    """
    username = getattr(event, 'username', None)
    if username and username != '-':
      return username

    session_identifier = event.GetSessionIdentifier()
    if session_identifier is None:
      return default_username

    user_sid = getattr(event, 'user_sid', None)
    username = self._knowledge_base.GetUsernameByIdentifier(
        user_sid, session_identifier=session_identifier)
    return username or default_username
def GetUsername ( self , event , default_username = '-' ) : username = getattr ( event , 'username' , None ) if username and username != '-' : return username session_identifier = event . GetSessionIdentifier ( ) if session_identifier is None : return default_username user_sid = getattr ( event , 'user_sid' , None ) username = self . _knowledge_base . GetUsernameByIdentifier ( user_sid , session_identifier = session_identifier ) return username or default_username
Retrieves the username related to the event.

    Args:
      event (EventObject): event.
      default_username (Optional[str]): default username.

    Returns:
      str: username.