def flatten(lst):
    """Completely flatten an arbitrarily-deep list"""
    return [*_flatten(lst)]


def _flatten(lst):
    """Generator for flattening arbitrarily-deep lists"""
    if isinstance(lst, (list, tuple)):
        for item in lst:
            if item is None:
                continue
            else:
                yield from _flatten(item)
    else:
        yield lst

def flatten(lst):
    """Completely flatten an arbitrarily-deep list"""
    return [*_flatten(lst)]


def _flatten(lst):
    """Generator for flattening arbitrarily-deep lists"""
    for item in lst:
        if isinstance(item, (list, tuple)):
            yield from _flatten(item)
        elif item is not None:
            yield item

Tidy and simplify generator code
Tidy and simplify generator code

  def flatten(lst):
      """Completely flatten an arbitrarily-deep list"""
      return [*_flatten(lst)]
  
  
  def _flatten(lst):
      """Generator for flattening arbitrarily-deep lists"""
-     if isinstance(lst, (list, tuple)):
-         for item in lst:
+     for item in lst:
+         if isinstance(item, (list, tuple)):
-             if item is None:
-                 continue
-             else:
-                 yield from _flatten(item)
+             yield from _flatten(item)
-     else:
+         elif item is not None:
-         yield lst
+             yield item
  
Tidy and simplify generator code
## Code Before:
def flatten(lst):
    """Completely flatten an arbitrarily-deep list"""
    return [*_flatten(lst)]


def _flatten(lst):
    """Generator for flattening arbitrarily-deep lists"""
    if isinstance(lst, (list, tuple)):
        for item in lst:
            if item is None:
                continue
            else:
                yield from _flatten(item)
    else:
        yield lst

## Instruction:
Tidy and simplify generator code
## Code After:
def flatten(lst):
    """Completely flatten an arbitrarily-deep list"""
    return [*_flatten(lst)]


def _flatten(lst):
    """Generator for flattening arbitrarily-deep lists"""
    for item in lst:
        if isinstance(item, (list, tuple)):
            yield from _flatten(item)
        elif item is not None:
            yield item
