def iter_fields(fields):
 if isinstance(fields, dict):
  return ((k, v) for (k, v) in six.iteritems(fields))
 return ((k, v) for (k, v) in fields)

def iter_fields ( fields ) : if isinstance ( fields , dict ) : return ( ( k , v ) for ( k , v ) in six . iteritems ( fields ) ) return ( ( k , v ) for ( k , v ) in fields )
yield a tuple of for each field in node .