def apply(self, data):
if self.visitor.is_object:<EOL><INDENT>obj = {}<EOL>if self.visitor.parent is None:<EOL><INDENT>obj['<STR_LIT>'] = self.visitor.path<EOL><DEDENT>obj_empty = True<EOL>for child in self.children:<EOL><INDENT>empty, value = child.apply(data)<EOL>if empty and child.optional:<EOL><INDENT>continue<EOL><DEDENT>obj_empty = False if not empty else obj_empty<EOL>if child.visitor.name in obj and child.visitor.is_array:<EOL><INDENT>obj[child.visitor.name].extend(value)<EOL><DEDENT>else:<EOL><INDENT>obj[child.visitor.name] = value<EOL><DEDENT><DEDENT>return obj_empty, obj<EOL><DEDENT>elif self.visitor.is_array:<EOL><INDENT>empty, value = self.children.apply(data)<EOL>return empty, [value]<EOL><DEDENT>elif self.visitor.is_value:<EOL><INDENT>return extract_value(self.mapping, self.visitor, data)<EOL><DEDENT>
Apply the given mapping to ``data``, recursively. The return type
        is a tuple of a boolean and the resulting data element. The boolean
        indicates whether any values were mapped in the child nodes of the
        mapping. It is used to skip optional branches of the object graph.