def is_allowed(self, user_agent, url, syntax=GYM2008):
        """True if the user agent is permitted to visit the URL. The syntax 
        parameter can be GYM2008 (the default) or MK1996 for strict adherence 
        to the traditional standard.
        """        
        if PY_MAJOR_VERSION < 3:
            # The robot rules are stored internally as Unicode. The two lines 
            # below ensure that the parameters passed to this function are 
            # also Unicode. If those lines were not present and the caller 
            # passed a non-Unicode user agent or URL string to this function,
            # Python would silently convert it to Unicode before comparing it
            # to the robot rules. Such conversions use the default encoding 
            # (usually US-ASCII) and if the string couldn't be converted using
            # that encoding, Python would raise a UnicodeError later on in the
            # guts of this code which would be confusing. 
            # Converting the strings to Unicode here doesn't make the problem
            # go away but it does make the conversion explicit so that 
            # failures are easier to understand. 
            if not isinstance(user_agent, unicode):
                user_agent = user_agent.decode()
            if not isinstance(url, unicode):
                url = url.decode()
        
        if syntax not in (MK1996, GYM2008):
            _raise_error(ValueError, "Syntax must be MK1996 or GYM2008")
    
        for ruleset in self.__rulesets:
            if ruleset.does_user_agent_match(user_agent):
                return ruleset.is_url_allowed(url, syntax)
                
        return True