<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def has_perm(self, user, perm, obj=None, *args, **kwargs):
 """Test user permissions for a single action and object. :param user: The user to test. :type user: ``User`` :param perm: The action to test. :type perm: ``str`` :param obj: The object path to test. :type obj: ``tutelary.engine.Object`` :returns: ``bool`` -- is the action permitted? """

        try:
            if not self._obj_ok(obj):
                if hasattr(obj, 'get_permissions_object'):
                    obj = obj.get_permissions_object(perm)
                else:
                    raise InvalidPermissionObjectException
            return user.permset_tree.allow(Action(perm), obj)
        except ObjectDoesNotExist:
            return False