docs: def extract_fasta(
      partition_file,
      fasta_file,
      output_dir,
      chunk_size=DEFAULT_CHUNK_SIZE,
      max_cores=DEFAULT_MAX_CORES,
  ):
  
      """Extract sequences from bins
  
      Identify bins, extract chunks belonging to each bins and gather them
      in a single FASTA file.
  
      Parameters
      ----------
      partition_file : file, str or pathlib.Path
          The file containing, for each chunk, the communities it was
          assigned to at each iteration.
      fasta_file : file, str or pathlib.Path
          The initial assembly from which chunks were initialized.
      output_dir : str or pathlib.Path
          The output directory to write the FASTA chunks into.
      chunk_size : int, optional
          The size of the chunks (in bp) used in the pipeline. Default is 1000.
      max_cores : int, optional
          How many bins to extract FASTA sequences from. Default is 100.
      """
  
      genome = {
          record.id: record.seq for record in SeqIO.parse(fasta_file, "fasta")
      }
  
      data_chunks = list(
          zip(*np.genfromtxt(partition_file, usecols=(0, 1), dtype=None))
      )
  
      chunk_names = np.array(data_chunks[0], dtype=object)
      cores = np.array(data_chunks[1])
      for core in set(cores):
          if core > max_cores:
              continue
          chunks_to_keep = chunk_names[cores == core]
          core_name = "core_{}.fa".format(core)
  
          core_file = os.path.join(output_dir, core_name)
  
          with open(core_file, "w") as core_handle:
              for name in chunks_to_keep:
                  fields = name.split("_")
                  header_name = "_".join(fields[:-1])
                  chunk = int(fields[-1])
  
                  pos_start = chunk * chunk_size
                  pos_end = min(
                      (chunk + 1) * chunk_size, len(genome[header_name])
                  )
  
                  sequence = str(genome[header_name][pos_start:pos_end])
  
                  core_handle.write(">{}\n".format(name))
                  core_handle.write("{}\n".format(sequence))