def _convert_todo(p_todo):
    """ Converts a Todo instance to a dictionary. """
    creation_date = p_todo.creation_date()
    completion_date = p_todo.completion_date()
    result = {'source': p_todo.source(), 'text': p_todo.text(), 'priority':
        p_todo.priority(), 'completed': p_todo.is_completed(), 'tags':
        p_todo.tags(), 'projects': list(p_todo.projects()), 'contexts':
        list(p_todo.contexts()), 'creation_date': creation_date.isoformat() if
        creation_date else None, 'completion_date': completion_date.
        isoformat() if completion_date else None}
    return result
