human
Complete the below
def _AddIsInitializedMethod(message_descriptor, cls):

    ''''Adds the IsInitialized and FindInitializationError methods to the
    protocol message class.'
    '''

=====
Give me a the Python code you requested?
assistant
#Here is the Python code you requested.
    required_fields = [field for field in message_descriptor.fields if (field.label == _FieldDescriptor.LABEL_REQUIRED)]
    def IsInitialized(self, errors=None):
        'Checks    if    all    required    fields    of    a    message    are    set.\n\n                Args:\n                        errors:        A    list    which,    if    provided,    will    be    populated    with    the    field\n                                                            paths    of    all    missing    required    fields.\n\n                Returns:\n                        True    iff    the    specified    message    has    all    required    fields    set.\n                '
        for field in required_fields:
            if ((field not in self._fields) or ((field.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE) and (not self._fields[field]._is_present_in_parent))):
                if (errors is not None):
                    errors.extend(self.FindInitializationErrors())
                return False
        for (field, value) in self._fields.iteritems():
            if (field.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE):
                if (field.label == _FieldDescriptor.LABEL_REPEATED):
                    for element in value:
                        if (not element.IsInitialized()):
                            if (errors is not None):
                                errors.extend(self.FindInitializationErrors())
                            return False
                elif (value._is_present_in_parent and (not value.IsInitialized())):
                    if (errors is not None):
                        errors.extend(self.FindInitializationErrors())
                    return False
        return True
    cls.IsInitialized = IsInitialized
    def FindInitializationErrors(self):
        'Finds    required    fields    which    are    not    initialized.\n\n                Returns:\n                        A    list    of    strings.        Each    string    is    a    path    to    an    uninitialized    field ...