recursive by Generator in Python