def get_state(self, as_str=False):
        """Returns user state. See ``UserState``.

        :param bool as_str: Return human-friendly state name instead of an ID.
        :rtype: int|str
        """

        uid = self.user_id

        if self._iface_user.get_id() == uid:
            result = self._iface.get_my_state()

        else:
            result = self._iface.get_state(uid)

        if as_str:
            return UserState.get_alias(result)

        return result
Returns user state. See ``UserState``.

        :param bool as_str: Return human-friendly state name instead of an ID.
        :rtype: int|str