code: def spin_gen_op(oper, gauge):
      
      slaves = len(gauge)
      oper['O'] = np.array([spin_gen(slaves, i, c) for i, c in enumerate(gauge)])
      oper['O_d'] = np.transpose(oper['O'], (0, 2, 1))
      oper['O_dO'] = np.einsum('...ij,...jk->...ik', oper['O_d'], oper['O'])
      oper['Sfliphop'] = spinflipandhop(slaves)
docs: Generates the generic spin matrices for the system