from . import shippers


def barcode(b):
    for klass in ['DHL', 'FedExExpress', 'FedExGround96', 'UPS', 'USPSIMpb', 'USPS13']:
        shipper = getattr(shippers, klass)(b)
        if shipper.is_valid:
            return shipper
    return shippers.Unknown(b)

from . import shippers


def barcode(b, barcode_classes=None):
    if barcode_classes is None:
        barcode_classes = ['DHL', 'FedExExpress', 'FedExGround96', 'UPS', 'USPSIMpb', 'USPS13']
    for klass in barcode_classes:
        shipper = getattr(shippers, klass)(b)
        if shipper.is_valid:
            return shipper
    return shippers.Unknown(b)

Allow barcode classes to be optionally specified
Allow barcode classes to be optionally specified

  from . import shippers
  
  
- def barcode(b):
+ def barcode(b, barcode_classes=None):
+     if barcode_classes is None:
-     for klass in ['DHL', 'FedExExpress', 'FedExGround96', 'UPS', 'USPSIMpb', 'USPS13']:
+         barcode_classes = ['DHL', 'FedExExpress', 'FedExGround96', 'UPS', 'USPSIMpb', 'USPS13']
+     for klass in barcode_classes:
          shipper = getattr(shippers, klass)(b)
          if shipper.is_valid:
              return shipper
      return shippers.Unknown(b)
  
Allow barcode classes to be optionally specified
## Code Before:
from . import shippers


def barcode(b):
    for klass in ['DHL', 'FedExExpress', 'FedExGround96', 'UPS', 'USPSIMpb', 'USPS13']:
        shipper = getattr(shippers, klass)(b)
        if shipper.is_valid:
            return shipper
    return shippers.Unknown(b)

## Instruction:
Allow barcode classes to be optionally specified
## Code After:
from . import shippers


def barcode(b, barcode_classes=None):
    if barcode_classes is None:
        barcode_classes = ['DHL', 'FedExExpress', 'FedExGround96', 'UPS', 'USPSIMpb', 'USPS13']
    for klass in barcode_classes:
        shipper = getattr(shippers, klass)(b)
        if shipper.is_valid:
            return shipper
    return shippers.Unknown(b)
