code: def reorder(miz_file_path: typing.Union[str, Path],
                  target_dir: typing.Union[str, Path],
                  skip_options_file: bool,
                  ):
          
  
          miz_file_path = Path(miz_file_path).absolute()
          if not miz_file_path.exists():
              raise FileNotFoundError(miz_file_path)
          if not miz_file_path.is_file():
              raise ValueError(f'not a file: {miz_file_path}')
  
          target_dir_path = Path(target_dir).absolute()
          if not target_dir_path.exists():
              target_dir_path.mkdir(parents=True)
          else:
              if not target_dir_path.is_dir():
                  raise ValueError(f'not a directory: {target_dir_path}')
  
          LOGGER.debug('re-ordering miz file: %s', miz_file_path)
          LOGGER.debug('destination folder: %s', target_dir)
          LOGGER.debug('%s option file', "skipping" if skip_options_file else "including")
  
          if not target_dir_path.exists():
              LOGGER.debug('creating directory %s', target_dir_path)
              target_dir_path.mkdir(exist_ok=True)
  
          Miz._do_reorder(miz_file_path, skip_options_file, target_dir_path)
docs: Re-orders a miz file into a folder (flattened)
  
          Args:
              miz_file_path: source miz file
              target_dir: folder to flatten the content into
              skip_options_file: do not re-order option file