# Buggy code
def __init__(self, data, header, plot_settings=None, **kwargs):
    super(GenericMap, self).__init__(data, meta=header, **kwargs)

    # Correct possibly missing meta keywords
    self._fix_date()
    self._fix_naxis()

    # Setup some attributes
    self._nickname = None

    # Validate header
    # TODO: This should be a function of the header, not of the map
    self._validate_meta()
    self._shift = SpatialPair(0 * u.arcsec, 0 * u.arcsec)

    if self.dtype == np.uint8:
        norm = None
    else:
        norm = colors.Normalize()

    # Visualization attributes
    self.plot_settings = {
        "cmap": cm.gray,
        "norm": norm,
        "interpolation": "nearest",
        "origin": "lower",
    }
    if plot_settings:
        self.plot_settings.update(plot_settings)


# Traceback (TypeError)
In [6]: map.Map('1130643840_vv_c076-077_f8-14_t034345_t034444_XX_d002.fits')
Out[6]: ---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/Users/kamen/anaconda/lib/python2.7/site-packages/IPython/core/formatters.pyc in __call__(self, obj)
697                 type_pprinters=self.type_printers,
698                 deferred_pprinters=self.deferred_printers)
--> 699             printer.pretty(obj)
700             printer.flush()
701             return stream.getvalue()

/Users/kamen/anaconda/lib/python2.7/site-packages/IPython/lib/pretty.pyc in pretty(self, obj)
381                             if callable(meth):
382                                 return meth(obj, self, cycle)
--> 383             return _default_pprint(obj, self, cycle)
384         finally:
385             self.end_group()

/Users/kamen/anaconda/lib/python2.7/site-packages/IPython/lib/pretty.pyc in _default_pprint(obj, p, cycle)
501     if _safe_getattr(klass, '__repr__', None) not in _baseclass_reprs:
502         # A user-provided repr. Find newlines and replace them with p.break_()
--> 503         _repr_pprint(obj, p, cycle)
504         return
505     p.begin_group(1, '<')

/Users/kamen/anaconda/lib/python2.7/site-packages/IPython/lib/pretty.pyc in _repr_pprint(obj, p, cycle)
692     """A pprint that just redirects to the normal repr function."""
693     # Find newlines and replace them with p.break_()
--> 694     output = repr(obj)
695     for idx,output_line in enumerate(output.splitlines()):
696         if idx:

/Users/kamen/anaconda/lib/python2.7/site-packages/sunpy/map/mapbase.py in __repr__(self)
221            obs=self.observatory, inst=self.instrument, det=self.detector,
222            meas=self.measurement, wave=self.wavelength, date=self.date, dt=self.exposure_time,
--> 223            dim=u.Quantity(self.dimensions),
224            scale=u.Quantity(self.scale),
225            tmf=TIME_FORMAT)

/Users/kamen/anaconda/lib/python2.7/site-packages/sunpy/map/mapbase.py in dimensions(self)
301         The dimensions of the array (x axis first, y axis second).
302         """
--> 303         return Pair(*u.Quantity(np.flipud(self.data.shape), 'pixel'))
304
305     @property

TypeError: __new__() takes exactly 3 arguments (5 given)

# Fixed code
def __init__(self, data, header, plot_settings=None, **kwargs):
    # If the data has more than two dimensions, the first dimensions
    # (NAXIS1, NAXIS2) are used and the rest are discarded.
    ndim = data.ndim
    if ndim > 2:
        # We create a slice that removes all but the 'last' two
        # dimensions. (Note dimensions in ndarray are in reverse order)

        new_2d_slice = [0] * (ndim - 2)
        new_2d_slice.extend([slice(None), slice(None)])
        data = data[new_2d_slice]
        # Warn the user that the data has been truncated
        warnings.warn_explicit(
            "This file contains more than 2 dimensions. "
            "Only the first two dimensions will be used."
            " The truncated data will not be saved in a new file.",
            Warning,
            __file__,
            inspect.currentframe().f_back.f_lineno,
        )

    super(GenericMap, self).__init__(data, meta=header, **kwargs)

    # Correct possibly missing meta keywords
    self._fix_date()
    self._fix_naxis()

    # Setup some attributes
    self._nickname = None

    # Validate header
    # TODO: This should be a function of the header, not of the map
    self._validate_meta()
    self._shift = SpatialPair(0 * u.arcsec, 0 * u.arcsec)

    if self.dtype == np.uint8:
        norm = None
    else:
        norm = colors.Normalize()

    # Visualization attributes
    self.plot_settings = {
        "cmap": cm.gray,
        "norm": norm,
        "interpolation": "nearest",
        "origin": "lower",
    }
    if plot_settings:
        self.plot_settings.update(plot_settings)