def serialize(self, as_dict=False, sort=None):
        files = getattr(self, 'files', self.run())
        if as_dict:
            return dict((fn, p.to_dict()) for fn, p in files.items())
        data = (p.to_dict() for p in files.values())
        if callable(sort):
            return sorted(data, key=sort)
        elif sort is True:
            return sorted(data)
        return list(data)