'Override of the default serialize method, since when we\'re serializing
a task we don\'t want to include the attribute list of tasks.'

def serialize(self):

    data = dict()
    for attr in self._valid_attrs:
        if (attr not in ('block', 'rescue', 'always')):
            data[attr] = getattr(self, attr)
    data['dep_chain'] = self.get_dep_chain()
    data['eor'] = self._eor
    if (self._role is not None):
        data['role'] = self._role.serialize()
    if (self._parent is not None):
        data['parent'] = self._parent.copy(exclude_tasks=True).serialize()
        data['parent_type'] = self._parent.__class__.__name__
    return data
