def Make_anti_commuting_sets_same_length(anti_commuting_sets, max_set_size):
    """
     Makes every set in anti_commuting_sets dictionary the same length, by adding None terms
     to instance when too short.

     This is very useful for finding 'longest tree'

    Args:
        anti_commuting_sets (dict): Dictionary of anti_commuting sets of PauliWords
        max_set_size (int): Length of longest anti_commuting set

    Returns:
        FILLED_anti_commuting_sets (dic): Dictionary of anti_commuting_sets with all sets the same size

    .. code-block:: python
   :emphasize-lines: 15

   from quchem.Tree_Fucntions import *

   anti_commuting_sets = {
                            0: [{'I0 I1 I2 I3 I4 I5 I6 I7 I8 I9 I10 I11': {'Cofactors': (-3.9344419569678517+0j)}}],

                            1: [ {'I0 I1 I2 I3 I4 I5 Z6 I7 I8 I9 I10 I11': {'Cofactors': (-0.21675429325000556+0j)}},
                                 {'I0 I1 I2 I3 I4 I5 Y6 X7 X8 Y9 I10 I11': {'Cofactors': (0.004217284878422758+0j)}},
                                 {'Y0 Y1 I2 I3 I4 I5 X6 X7 I8 I9 I10 I11': {'Cofactors': (-0.002472706153881531+0j)}},
                                 {'Y0 Z1 Z2 Y3 I4 I5 X6 X7 I8 I9 I10 I11': {'Cofactors': (0.0020778874983957123+0j)}},
                                 {'Y0 Z1 Z2 Z3 Z4 Y5 X6 X7 I8 I9 I10 I11': {'Cofactors': (0.002562389780011484+0j)}},
                                 {'Y0 Z1 Z2 Z3 Z4 Z5 Y6 Y7 Z8 Z9 Z10 Y11': {'Cofactors': (0.0009084689616229714+0j)}}
                               ]
                         }
   max_set_size = Get_longest_anti_commuting_set(anti_commuting_sets)
   Make_anti_commuting_sets_same_length(anti_commuting_sets, max_set_size)
   >> {0: [ {'I0 I1 I2 I3 I4 I5 I6 I7 I8 I9 I10 I11': {'Cofactors': (-3.9344419569678517+0j)}},
              None,
              None,
              None,
              None,
              None
           ],

     1:  [ {'I0 I1 I2 I3 I4 I5 Z6 I7 I8 I9 I10 I11': {'Cofactors': (-0.21675429325000556+0j)}},
           {'I0 I1 I2 I3 I4 I5 Y6 X7 X8 Y9 I10 I11': {'Cofactors': (0.004217284878422758+0j)}},
           {'Y0 Y1 I2 I3 I4 I5 X6 X7 I8 I9 I10 I11': {'Cofactors': (-0.002472706153881531+0j)}},
           {'Y0 Z1 Z2 Y3 I4 I5 X6 X7 I8 I9 I10 I11': {'Cofactors': (0.0020778874983957123+0j)}},
           {'Y0 Z1 Z2 Z3 Z4 Y5 X6 X7 I8 I9 I10 I11': {'Cofactors': (0.002562389780011484+0j)}},
           {'Y0 Z1 Z2 Z3 Z4 Z5 Y6 Y7 Z8 Z9 Z10 Y11': {'Cofactors': (0.0009084689616229714+0j)}}
         ]
       }

    """

    FILLED_anti_commuting_sets = {}

    for key in anti_commuting_sets:
        len_term = len(anti_commuting_sets[key])
        if len_term == max_set_size:
            FILLED_anti_commuting_sets[key] = anti_commuting_sets[key]
        else:
            number_to_add = max_set_size - len_term
            None_list = [None for _ in range(number_to_add)]
            FILLED_anti_commuting_sets[key] = [*anti_commuting_sets[key], *None_list]
    return FILLED_anti_commuting_sets