docs: def get_missing_blocks(info_frags_records, matching_pairs, linkage_orderings):
      """Get missing blocks in a scaffold based on the genetic map order.
  
      Given matching scaffold blocks/genetic map blocks (based on restriction 
      sites and SNP markers, respectively), move around the scaffold blocks
      such that they map the genetic map order.
  
      Parameters
      ----------
      info_frags_records : dict
          A dictionary representing the scaffolds and their block order as
          described in an info_frags.txt file
      matching_pairs : dict
          A list of best matching pairs in the form 
          (scaffold_block, linkage group)
      linkage_orderings : dict
          A dictionary representing the genetic map and the linkage groups
          as described in csv file.        
  
      Example
      -------
  
          >>> linkage_orderings = {
          ...     'linkage_group_1': [
          ...         ['sctg_516', -3, 36614, 50582, 1],
          ...         ['sctg_486', -3, 41893, 41893, 1],
          ...         ['sctg_486', -3, 50054, 62841, 1],
          ...         ['sctg_207', -3, 31842, 94039, 1],
          ...         ['sctg_558', -3, 51212, 54212, 1],
          ...     ],
          ...     'linkage_group_2': [
          ...         ['sctg_308', -3, 15892, 25865, 1],
          ...         ['sctg_842', -3, 0, 8974, 1],
          ...         ['sctg_994', -3, 0, 81213, 1],
          ...     ],
          ... }
          >>> info_frags = {
          ...     'scaffold_A': [
          ...         ['sctg_308', 996, 15892, 25865, 1],
          ...         ['sctg_778', 1210, 45040, 78112, -1],
          ...         ['sctg_842', 124, 0, 8974, 1],
          ...     ],
          ...     'scaffold_B': [
          ...         ['sctg_516', 5, 0, 38000, 1],
          ...         ['sctg_486', 47, 42050, 49000, 1],
          ...         ['sctg_1755', 878, 95001, 10844, -1],
          ...         ['sctg_842', 126, 19000, 26084, 1],
          ...         ['sctg_207', 705, 45500, 87056, 1],
          ...     ],
          ...     'scaffold_C': [
          ...        ['sctg_558', 745, 50045, 67851, 1],
          ...        ['sctg_994', 12, 74201, 86010, -1],
          ...     ],
          ... }
          >>> matching_pairs = compare_orderings(info_frags, linkage_orderings)
          >>> new_records = get_missing_blocks(info_frags, matching_pairs,
          ...                                  linkage_orderings)
          >>> for my_bin in new_records['scaffold_A']:
          ...     print(list(my_bin))
          ...
          ['sctg_308', 996, 15892, 25865, 1]
          ['sctg_778', 1210, 45040, 78112, -1]
          ['sctg_842', 124, 0, 8974, 1]
          ['sctg_842', 126, 19000, 26084, 1]
          ['sctg_994', 12, 74201, 86010, -1]
  
          >>> for my_bin in new_records['scaffold_B']:
          ...     print(list(my_bin))
          ...
          ['sctg_516', 5, 0, 38000, 1]
          ['sctg_486', 47, 42050, 49000, 1]
          ['sctg_1755', 878, 95001, 10844, -1]
          ['sctg_207', 705, 45500, 87056, 1]
          ['sctg_558', 745, 50045, 67851, 1]
  
      """
  
      import logging
      import sys
  
      logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
  
      logger = logging.getLogger()
      logger.setLevel(logging.DEBUG)
  
      touched_lgs = set()
  
      def record_length(key_record_tuple):
          return len(key_record_tuple[1])
  
      new_scaffolds = copy.deepcopy(info_frags_records)
  
      for scaffold_name in collections.OrderedDict(
          sorted(new_scaffolds.items(), key=record_length, reverse=True)
      ):
          scaffold = new_scaffolds[scaffold_name]
          new_scaffold = []
          corresponding_lg = matching_pairs[scaffold_name][1]
          if corresponding_lg in touched_lgs:
              continue
          else:
              touched_lgs.add(corresponding_lg)
          scaffold_block_names = {my_bin[0] for my_bin in scaffold}
          lg_block_names = [
              my_block[0] for my_block in linkage_orderings[corresponding_lg]
          ]
  
          touched_bins = set()
  
          for lg_block_name in lg_block_names:
              if lg_block_name in scaffold_block_names:
                  for my_bin in scaffold:
                      if tuple(my_bin) in new_scaffold:
                          continue
                      elif (
                          my_bin[0] == lg_block_name
                          or my_bin[0] not in lg_block_names
                      ):
                          new_scaffold.append(tuple(my_bin))
                          touched_bins.add(tuple(my_bin))
                      else:
                          break
              for other_name, other_scaffold in new_scaffolds.items():
                  if other_name == scaffold_name:
                      continue
                  i = 0
                  for my_bin in other_scaffold:
                      if tuple(my_bin) in new_scaffold:
                          i += 1
                          continue
                      elif my_bin[0] == lg_block_name:
                          moved_bin = tuple(other_scaffold.pop(i))
                          new_scaffold.append(tuple(moved_bin))
                          touched_bins.add(tuple(moved_bin))
                          i -= 1
                      i += 1
  
          for remaining_bin in scaffold:
              if tuple(remaining_bin) not in touched_bins:
                  new_scaffold.append(tuple(remaining_bin))
                  touched_bins.add(tuple(remaining_bin))
  
          if len(new_scaffold) > 0:
              new_scaffolds[scaffold_name] = new_scaffold
  
      return new_scaffolds