def METHOD_NAME(moving_h, angles, direction_forward=True, check_omega=False):
  """
  angles = [(phi, psi), (phi, psi), ... (phi, psi)]
  phi or psi == None means we don't change this angle
  returns deep-copied hierarchy with new angles. Change occurs from first to
  last angle so starting point would be in the same place.
  This function should produce up to all possible favored conformations.
  This function doesn't change moving_h
  direction_forward==True - set from beginning to end - the end residue moves
  direction_forward==False - set from end to beginning, the first residue moves
  """
  # print "angles", angles
  # STOP()
  result_h = moving_h.deep_copy()
  result_h.reset_atom_i_seqs()
  fixed_omega = False
  phi_psi_atoms = utils.get_phi_psi_atoms(moving_h, omega=True)
  assert len(phi_psi_atoms) == len(angles), "%d != %d" % (len(phi_psi_atoms), len(angles))
  if not direction_forward:
    phi_psi_atoms.reverse()
    angles.reverse()
  for ps_atoms, target_angle_pair in zip(phi_psi_atoms, angles):
    phi_psi_pair = ps_atoms[0]
    # print "phi_psi_pair", phi_psi_pair
    omega = ps_atoms[2]
    phi_psi_angles = utils.get_pair_angles(phi_psi_pair)
    # print "ps_atoms, target_angle_pair", phi_psi_angles, target_angle_pair
    # phi
    if target_angle_pair[0] is not None and phi_psi_angles[0] is not None:
      rotation_angle = -phi_psi_angles[0]+target_angle_pair[0]
      # print "rot angle", rotation_angle
      # if not direction_forward:
      #   rotation_angle = -rotation_angle
      utils.rotate_atoms_around_bond(
          result_h,
          phi_psi_pair[0][1],
          phi_psi_pair[0][2],
          angle=rotation_angle,
          direction_forward=direction_forward)
    # psi
    if target_angle_pair[1] is not None and phi_psi_angles[1] is not None:
      rotation_angle = -phi_psi_angles[1]+target_angle_pair[1]
      # print "rot angle", rotation_angle
      # if not direction_forward:
      #   rotation_angle = -rotation_angle
      utils.rotate_atoms_around_bond(
          result_h,
          phi_psi_pair[1][1],
          phi_psi_pair[1][2],
          angle=rotation_angle,
          direction_forward=direction_forward)
    # omega
    if omega is not None and abs(abs(omega)-180) > 10 and check_omega:
      rotation_angle= -omega+180
      # print "Omega rotation:", omega, rotation_angle
      utils.rotate_atoms_around_bond(
          result_h,
          phi_psi_pair[0][0],
          phi_psi_pair[0][1],
          angle=rotation_angle,
          direction_forward=direction_forward)
      fixed_omega = True
  # print utils.list_rama_outliers_h(result_h)
  # result_h.write_pdb_file(file_name="variant_%s.pdb" % direction_forward)
  # STOP()
  return result_h, fixed_omega