<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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