# Buggy code
def _get_format_function(data, **options):
    """
    find the right formatting function for the dtype_
    """
    dtype_ = data.dtype
    if dtype_.fields is not None:
        return StructureFormat.from_data(data, **options)

    dtypeobj = dtype_.type
    formatdict = _get_formatdict(data, **options)
    if issubclass(dtypeobj, _nt.bool_):
        return formatdict["bool"]()
    elif issubclass(dtypeobj, _nt.integer):
        if issubclass(dtypeobj, _nt.timedelta64):
            return formatdict["timedelta"]()
        else:
            return formatdict["int"]()
    elif issubclass(dtypeobj, _nt.floating):
        if issubclass(dtypeobj, _nt.longfloat):
            return formatdict["longfloat"]()
        else:
            return formatdict["float"]()
    elif issubclass(dtypeobj, _nt.complexfloating):
        if issubclass(dtypeobj, _nt.clongfloat):
            return formatdict["longcomplexfloat"]()
        else:
            return formatdict["complexfloat"]()
    elif issubclass(dtypeobj, (_nt.unicode_, _nt.string_)):
        return formatdict["numpystr"]()
    elif issubclass(dtypeobj, _nt.datetime64):
        return formatdict["datetime"]()
    elif issubclass(dtypeobj, _nt.object_):
        return formatdict["object"]()
    elif issubclass(dtypeobj, _nt.void):
        return formatdict["void"]()
    else:
        return formatdict["numpystr"]()


# Traceback (TypeError)
import numpy as np
x = np.zeros(3, dtype=('i4',[('r','u1'), ('g','u1'), ('b','u1'), ('a','u1')]))
x
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/tos/py3npy/lib/python3.6/site-packages/numpy-1.14.0.dev0+1f4ed32-py3.6-macosx-10.12-x86_64.egg/numpy/core/arrayprint.py", line 955, in array_repr
', ', class_name + "(")
File "/Users/tos/py3npy/lib/python3.6/site-packages/numpy-1.14.0.dev0+1f4ed32-py3.6-macosx-10.12-x86_64.egg/numpy/core/arrayprint.py", line 521, in array2string
lst = _array2string(a, options, separator, prefix)
File "/Users/tos/py3npy/lib/python3.6/site-packages/numpy-1.14.0.dev0+1f4ed32-py3.6-macosx-10.12-x86_64.egg/numpy/core/arrayprint.py", line 363, in wrapper
return f(self, *args, **kwargs)
File "/Users/tos/py3npy/lib/python3.6/site-packages/numpy-1.14.0.dev0+1f4ed32-py3.6-macosx-10.12-x86_64.egg/numpy/core/arrayprint.py", line 392, in _array2string
options['edgeitems'], summary_insert)[:-1]
File "/Users/tos/py3npy/lib/python3.6/site-packages/numpy-1.14.0.dev0+1f4ed32-py3.6-macosx-10.12-x86_64.egg/numpy/core/arrayprint.py", line 565, in _formatArray
word = format_function(a[-i]) + separator
File "/Users/tos/py3npy/lib/python3.6/site-packages/numpy-1.14.0.dev0+1f4ed32-py3.6-macosx-10.12-x86_64.egg/numpy/core/arrayprint.py", line 886, in __call__
for field, format_function in zip(x, self.format_functions):
TypeError: zip argument #1 must support iteration

# Fixed code
def _get_format_function(data, **options):
    """
    find the right formatting function for the dtype_
    """
    dtype_ = data.dtype
    dtypeobj = dtype_.type
    formatdict = _get_formatdict(data, **options)
    if issubclass(dtypeobj, _nt.bool_):
        return formatdict["bool"]()
    elif issubclass(dtypeobj, _nt.integer):
        if issubclass(dtypeobj, _nt.timedelta64):
            return formatdict["timedelta"]()
        else:
            return formatdict["int"]()
    elif issubclass(dtypeobj, _nt.floating):
        if issubclass(dtypeobj, _nt.longfloat):
            return formatdict["longfloat"]()
        else:
            return formatdict["float"]()
    elif issubclass(dtypeobj, _nt.complexfloating):
        if issubclass(dtypeobj, _nt.clongfloat):
            return formatdict["longcomplexfloat"]()
        else:
            return formatdict["complexfloat"]()
    elif issubclass(dtypeobj, (_nt.unicode_, _nt.string_)):
        return formatdict["numpystr"]()
    elif issubclass(dtypeobj, _nt.datetime64):
        return formatdict["datetime"]()
    elif issubclass(dtypeobj, _nt.object_):
        return formatdict["object"]()
    elif issubclass(dtypeobj, _nt.void):
        if dtype_.names is not None:
            return StructuredVoidFormat.from_data(data, **options)
        else:
            return formatdict["void"]()
    else:
        return formatdict["numpystr"]()