code: def _pull_out_unaffected_blocks_lhs(lhs, rest, out_port, in_port):
      
  
      _, block_index = lhs.index_in_block(out_port)
  
      bs = lhs.block_structure
  
      nbefore, nblock, nafter = (sum(bs[:block_index]),
                                 bs[block_index],
                                 sum(bs[block_index + 1:]))
      before, block, after = lhs.get_blocks((nbefore, nblock, nafter))
  
      if before != cid(nbefore) or after != cid(nafter):
          outer_lhs = before + cid(nblock - 1) + after
          inner_lhs = cid(nbefore) + block + cid(nafter)
          return outer_lhs << Feedback.create(
                  SeriesProduct.create(inner_lhs, *rest),
                  out_port=out_port, in_port=in_port)
      elif block == cid(nblock):
          outer_lhs = before + cid(nblock - 1) + after
          return outer_lhs << Feedback.create(
                  SeriesProduct.create(*rest),
                  out_port=out_port, in_port=in_port)
      raise CannotSimplify()
docs: In a self-Feedback of a series product, where the left-most operand is
      reducible, pull all non-trivial blocks outside of the feedback.
  
     Args:
         lhs (Circuit): The reducible circuit
         rest (tuple): The other SeriesProduct operands
         out_port (int): The feedback output port index
         in_port (int): The feedback input port index
  
     Returns:
         Circuit: The simplified circuit