@classmethod
def bad_syntax(cls, syntax, resource_name, ex=None):
    """Exception used when the resource name cannot be parsed.
        """
    if ex:
        msg = "The syntax is '%s' (%s)." % (syntax, ex)
    else:
        msg = "The syntax is '%s'." % syntax
    msg = "Could not parse '%s'. %s" % (resource_name, msg)
    return cls(msg)
