code: def xflatten(iterable, transform, check=is_iterable):
      
      for value in transform(iterable):
          if check(value):
              for flat in xflatten(value, transform, check):
                  yield flat
          else:
              yield value
docs: Apply a transform to iterable before flattening at each level.