<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def classpath_by_targets(cls, targets, classpath_products, confs=('default',)):
 """Return classpath entries grouped by their targets for the given `targets`. :param targets: The targets to lookup classpath products for. :param ClasspathProducts classpath_products: Product containing classpath elements. :param confs: The list of confs for use by this classpath. :returns: The ordered (target, classpath) mappings. :rtype: OrderedDict """

    classpath_target_tuples = classpath_products.get_product_target_mappings_for_targets(targets)
    filtered_items_iter = filter(cls._accept_conf_filter(confs, lambda x: x[0][0]),
                                            classpath_target_tuples)

    # group (classpath_entry, target) tuples by targets
    target_to_classpath = OrderedDict()
    for classpath_entry, target in filtered_items_iter:
      _, entry = classpath_entry
      if not target in target_to_classpath:
        target_to_classpath[target] = []
      target_to_classpath[target].append(entry)
    return target_to_classpath