'Make a directory to put the image data in'

def __make_dir(self):

    base_name = os.path.basename(getattr(self.__orig_file, 'name', self.__orig_file))
    base_name = os.path.splitext(base_name)[0]
    if self.__out_file:
        dir_name = os.path.dirname(getattr(self.__out_file, 'name', self.__out_file))
    else:
        dir_name = os.path.dirname(self.__orig_file)
    self.__dir_name = (base_name + '_rtf_pict_dir/')
    self.__dir_name = os.path.join(dir_name, self.__dir_name)
    if (not os.path.isdir(self.__dir_name)):
        try:
            os.mkdir(self.__dir_name)
        except OSError as msg:
            msg = ("%sCouldn't    make    directory    '%s':\n" % (str(msg), self.__dir_name))
            raise self.__bug_handler
    else:
        if (self.__run_level > 1):
            sys.stderr.write('Removing    files    from    old    pict    directory...\n')
        all_files = os.listdir(self.__dir_name)
        for the_file in all_files:
            the_file = os.path.join(self.__dir_name, the_file)
            try:
                os.remove(the_file)
            except OSError:
                pass
        if (self.__run_level > 1):
            sys.stderr.write('Files    removed.\n')
