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

    ''''Adds an __init__ method to cls.'
    '''
assistant
#Here is the Python code you requested.
    fields = message_descriptor.fields
    def init(self, **kwargs):
        self._cached_byte_size = 0
        self._cached_byte_size_dirty = (len(kwargs) > 0)
        self._fields = {}
        self._unknown_fields = ()
        self._is_present_in_parent = False
        self._listener = message_listener_mod.NullMessageListener()
        self._listener_for_children = _Listener(self)
        for (field_name, field_value) in kwargs.iteritems():
            field = _GetFieldByName(message_descriptor, field_name)
            if (field is None):
                raise TypeError(("%s()    got    an    unexpected    keyword    argument    '%s'" % (message_descriptor.name, field_name)))
            if (field.label == _FieldDescriptor.LABEL_REPEATED):
                copy = field._default_constructor(self)
                if (field.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE):
                    for val in field_value:
                        copy.add().MergeFrom(val)
                else:
                    copy.extend(field_value)
                self._fields[field] = copy
            elif (field.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE):
                copy = field._default_constructor(self)
                copy.MergeFrom(field_value)
                self._fields[field] = copy
            else:
                setattr(self, field_name, field_value)
    init.__module__ = None
    init.__doc__ = None
    cls.__init__ = init