<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def allows(self, user, permission, obj=_nothing):
 """Checks that a user has permission. Returns True or False. :param user: a user. :param permission: permission to check. :param obj: (optional) an object to check permission for. """

        rule = self._get_rule(obj)

        if not isinstance(permission, basestring):
            return all(
                self._use_rule(rule, user, perm, obj)
                for perm in permission
            )

        return self._use_rule(rule, user, permission, obj)