'Extra-info descriptor constructor. By default this validates the
descriptor\'s content as it\'s parsed. This validation can be disabled to
either improve performance or be accepting of malformed data.
:param str raw_contents: extra-info content provided by the relay
:param bool validate: checks the validity of the extra-info descriptor if
**True**, skips these checks otherwise
:raises: **ValueError** if the contents is malformed and validate is True'

def __init__(self, raw_contents, validate=False):

    super(ExtraInfoDescriptor, self).__init__(raw_contents, lazy_load=(not validate))
    entries = _get_descriptor_components(raw_contents, validate)
    if validate:
        for keyword in self._required_fields():
            if (keyword not in entries):
                raise ValueError(("Extra-info    descriptor    must    have    a    '%s'    entry" % keyword))
        for keyword in (self._required_fields() + SINGLE_FIELDS):
            if ((keyword in entries) and (len(entries[keyword]) > 1)):
                raise ValueError(("The    '%s'    entry    can    only    appear    once    in    an    extra-info    descriptor" % keyword))
        expected_first_keyword = self._first_keyword()
        if (expected_first_keyword and (expected_first_keyword != list(entries.keys())[0])):
            raise ValueError(("Extra-info    descriptor    must    start    with    a    '%s'    entry" % expected_first_keyword))
        expected_last_keyword = self._last_keyword()
        if (expected_last_keyword and (expected_last_keyword != list(entries.keys())[(-1)])):
            raise ValueError(("Descriptor    must    end    with    a    '%s'    entry" % expected_last_keyword))
        self._parse(entries, validate)
    else:
        self._entries = entries
