'Parameters
total_or_items : int or sequence
If an int, the number of increments in the process being
tracked.  If a sequence, the items to iterate over.
ipython_widget : bool, optional
If `True`, the progress bar will display as an IPython
notebook widget.
file : writable file-like object, optional
The file to write the progress bar to.  Defaults to
`sys.stdout`.  If ``file`` is not a tty (as determined by
calling its `isatty` member, if any, or special case hacks
to detect the IPython console), the progress bar will be
completely silent.'

def __init__(self, total_or_items, ipython_widget=False, file=None):

    if (file is None):
        file = _get_stdout()
    if ((not ipython_widget) and (not isatty(file))):
        self.update = self._silent_update
        self._silent = True
    else:
        self._silent = False
    if isiterable(total_or_items):
        self._items = iter(total_or_items)
        self._total = len(total_or_items)
    else:
        try:
            self._total = int(total_or_items)
        except TypeError:
            raise TypeError(u'First    argument    must    be    int    or    sequence')
        else:
            self._items = iter(range(self._total))
    self._file = file
    self._start_time = time.time()
    self._human_total = human_file_size(self._total)
    self._ipython_widget = ipython_widget
    self._signal_set = False
    if (not ipython_widget):
        self._should_handle_resize = (_CAN_RESIZE_TERMINAL and self._file.isatty())
        self._handle_resize()
        if self._should_handle_resize:
            signal.signal(signal.SIGWINCH, self._handle_resize)
            self._signal_set = True
    self.update(0)
