parameters: (x)
return_statement: return result
docstring: flatten(sequence) -> list
      Returns a single, flat list which contains all elements retrieved
      from the sequence and all nested sub-sequences (iterables).
      Examples:
      >>> [1, 2, [3,4], (5,6)]
      [1, 2, [3, 4], (5, 6)]
      >>> flatten([[[1,2,3], (42,None)], [4,5], [6], 7, MyVector(8,9,10)])
      [1, 2, 3, 42, None, 4, 5, 6, 7, 8, 9, 10]
docstring_summary: flatten(sequence) -> list
      Returns a single, flat list which contains all elements retrieved
      from the sequence and all nested sub-sequences (iterables).
      Examples:
      >>> [1, 2, [3,4], (5,6)]
      [1, 2, [3, 4], (5, 6)]
      >>> flatten([[[1,2,3], (42,None)], [4,5], [6], 7, MyVector(8,9,10)])
      [1, 2, 3, 42, None, 4, 5, 6, 7, 8, 9, 10]
docstring_tokens: flatten ( sequence ) - > list Returns a single flat list which contains all elements retrieved from the sequence and all nested sub - sequences ( iterables ) . Examples : >>> [ 1 2 [ 3 4 ] ( 5 6 ) ] [ 1 2 [ 3 4 ] ( 5 6 ) ] >>> flatten ( [[[ 1 2 3 ] ( 42 None ) ] [ 4 5 ] [ 6 ] 7 MyVector ( 8 9 10 ) ] ) [ 1 2 3 42 None 4 5 6 7 8 9 10 ]
function: def flatten(x):
    """flatten(sequence) -> list
      Returns a single, flat list which contains all elements retrieved
      from the sequence and all nested sub-sequences (iterables).
      Examples:
      >>> [1, 2, [3,4], (5,6)]
      [1, 2, [3, 4], (5, 6)]
      >>> flatten([[[1,2,3], (42,None)], [4,5], [6], 7, MyVector(8,9,10)])
      [1, 2, 3, 42, None, 4, 5, 6, 7, 8, 9, 10]"""
    result = []
    for el in x:
      if hasattr(el, "__iter__") and not isinstance(el, str):
        result.extend(flatten(el))
      else:
        result.append(el)
    return result
function_tokens: def flatten ( x ) : result = [ ] for el in x : if hasattr ( el , "__iter__" ) and not isinstance ( el , str ) : result . extend ( flatten ( el ) ) else : result . append ( el ) return result