parameters: (mapping)
return_statement: return result
docstring: Converts a hierarchical mapping to a flat dictionary
docstring_summary: Converts a hierarchical mapping to a flat dictionary
docstring_tokens: Converts a hierarchical mapping to a flat dictionary
function: def _flatten(mapping):
      """Converts a hierarchical mapping to a flat dictionary"""
      result = {}
      for k, v in mapping.items():
          if isinstance(v, dict):
              for ik, iv in _flatten(v).items():
                  ik = ik if isinstance(ik, tuple) else (ik,)
                  result[(k,) + ik] = iv
          elif isinstance(v, list):
              for ik, iv in enumerate(_flatten(v)):
                  ik = ik if isinstance(ik, tuple) else (ik,)
                  result[(k,) + ik] = iv
          else:
              result[(k,)] = v
      return result
function_tokens: def _flatten ( mapping ) : result = { } for k , v in mapping . items ( ) : if isinstance ( v , dict ) : for ik , iv in _flatten ( v ) . items ( ) : ik = ik if isinstance ( ik , tuple ) else ( ik , ) result [ ( k , ) + ik ] = iv elif isinstance ( v , list ) : for ik , iv in enumerate ( _flatten ( v ) ) : ik = ik if isinstance ( ik , tuple ) else ( ik , ) result [ ( k , ) + ik ] = iv else : result [ ( k , ) ] = v return result