'Checks if an attribute exists in a given enumeration, logging a message if
it isn\'t. Attributes can either be for a string or collection of strings
:param str attr: name of the attribute to check
:param stem.util.enum.Enum enum: enumeration to check against'

def _log_if_unrecognized(self, attr, attr_enum):

    attr_values = getattr(self, attr)
    if attr_values:
        if isinstance(attr_values, (bytes, str_type)):
            attr_values = [attr_values]
        for value in attr_values:
            if (value not in attr_enum):
                log_id = ('event.%s.unknown_%s.%s' % (self.type.lower(), attr, value))
                unrecognized_msg = ("%s    event    had    an    unrecognized    %s    (%s).    Maybe    a    new    addition    to    the    control    protocol?    Full    Event:    '%s'" % (self.type, attr, value, self))
                log.log_once(log_id, log.INFO, unrecognized_msg)
