'Return and clear the dirty state of the python object.'

def IsDirty(self, proto):

    if proto.dirty:
        return True
    for (python_format, _, type_descriptor) in proto.GetRawData().itervalues():
        if ((python_format is not None) and type_descriptor.IsDirty(python_format)):
            proto.dirty = True
            return True
    return False
