def eql_fn(o_node, a_node):
    result = False
    if isinstance(o_node, o.HeadlineNode):
        if isinstance(a_node, a.TaskNode):
            completed_from_type = {'TODO': False, 'DONE': True}
            tests = [
                (a_node.name == o_node.title),
                (getattr(a_node, 'notes',
                         None) == getattr(o_node, 'paragraph', None)),
                (a_node.completed == completed_from_type[o_node.todo_type]),
                (a_node.id == lib.safe_int(getattr(o_node, 'asana_id', None))),
                (a_node.project_id == lib.safe_int(
                    getattr(o_node, 'asana_project_id', None))),
                (getattr(o_node, 'deadline',
                         None) == (getattr(a_node, 'due_at', None)
                                   or (getattr(a_node, 'due_on', None)))),
                (getattr(a_node, 'tags',
                         None) == (getattr(o_node, 'tags', None)))
            ]
            result = all(tests)
    elif isinstance(o_node, o.FilenameNode):
        if isinstance(a_node, a.ProjectNode):
            tests = [(a_node.name == lib.basename_no_ext(o_node.id)),
                     (a_node.id == lib.safe_int(
                         getattr(o_node, 'asana_project_id', None)))]
            result = all(tests)
    return result
def map_fn(o_node, a_node):
    result = False
    if isinstance(o_node, o.HeadlineNode):
        if isinstance(a_node, a.TaskNode):
            o_node_asana_id = lib.safe_int(getattr(o_node, 'asana_id', None))
            if o_node_asana_id is None:
                result = o_node.title == a_node.name
            else:
                result = o_node_asana_id == a_node.id
    elif isinstance(o_node, o.FilenameNode):
        if isinstance(a_node, a.ProjectNode):
            o_node_project_id = lib.safe_int(
                getattr(o_node, 'asana_project_id', None))
            if o_node_project_id is None:
                result = lib.basename_no_ext(o_node.id) == a_node.name
            else:
                result = o_node_project_id == a_node.id
    return result