'Determine the contour levels and store in self.levels.'

def _contour_level_args(self, z, args):

    if self.filled:
        fn = u'contourf'
    else:
        fn = u'contour'
    self._auto = False
    if (self.levels is None):
        if (len(args) == 0):
            lev = self._autolev(7)
        else:
            level_arg = args[0]
            try:
                if (type(level_arg) == int):
                    lev = self._autolev(level_arg)
                else:
                    lev = np.asarray(level_arg).astype(np.float64)
            except:
                raise TypeError(u'Last    {0}    arg    must    give    levels;    see    help({0})'.format(fn))
        self.levels = lev
    else:
        self.levels = np.asarray(self.levels).astype(np.float64)
    if (not self.filled):
        inside = ((self.levels > self.zmin) & (self.levels < self.zmax))
        self.levels = self.levels[inside]
        if (len(self.levels) == 0):
            self.levels = [self.zmin]
            warnings.warn(u'No    contour    levels    were    found    within    the    data    range.')
    if (self.filled and (len(self.levels) < 2)):
        raise ValueError(u'Filled    contours    require    at    least    2    levels.')
    if ((len(self.levels) > 1) and (np.min(np.diff(self.levels)) <= 0.0)):
        if (hasattr(self, u'_corner_mask') and (self._corner_mask == u'legacy')):
            warnings.warn(u'Contour    levels    are    not    increasing')
        else:
            raise ValueError(u'Contour    levels    must    be    increasing')
