'Sort the sequence of objects by object\'s attribute
Arguments:
seq  - the list or any sequence (including immutable one) of objects to sort.
attr - the name of attribute to sort by'

def sort_by_attr(self, seq, attr):

    intermed = map(None, (getattr(_, attr) for _ in seq), range(len(seq)), seq)
    intermed.sort()
    return [_[(-1)] for _ in intermed]
