# Path: oscar_mws/utils.py
# def load_class(name, default=None):
#     if not name:
#         return None
#     try:
#         module_label, class_name = name.rsplit('.', 1)
#     except ValueError:
#         raise ImproperlyConfigured("cannot find class {0}".format(name))
#     imported_module = __import__(module_label, fromlist=[class_name])
#     try:
#         return _pluck_classes([imported_module], [class_name])[0]
#     except IndexError:
#         return None
# 
# def convert_camel_case(name):
#     s1 = FIRST_CAPITAL_PATTERN.sub(r'\1_\2', name)
#     return UPPERCASE_PATTERN.sub(r'\1_\2', s1).lower()


from collections import OrderedDict
from django.conf import settings
from ..utils import load_class, convert_camel_case
                product__amazon_profile__isnull=False)

        return [self.get_line_adapter(l) for l in lines]

    def get_fields(self, address=None, **kwargs):
        if address is None:
            address = self.order.shipping_address

        order_fields = {}
        order_fields.update(
            self.get_required_fields(address=address, **kwargs)
        )
        order_fields.update(
            self.get_optional_fields(address=address, **kwargs)
        )
        return order_fields


def get_order_adapter():
    adapter_class = OrderAdapter
    custom_adapter = getattr(settings, 'MWS_ORDER_ADAPTER', None)
    if custom_adapter:
        adapter_class = load_class(custom_adapter)
    return adapter_class


def get_order_line_adapter():
    adapter_class = OrderLineAdapter
    custom_adapter = getattr(settings, 'MWS_ORDER_LINE_ADAPTER', None)
    if custom_adapter:

# Path: oscar_mws/utils.py
# def load_class(name, default=None):
#     if not name:
#         return None
#     try:
#         module_label, class_name = name.rsplit('.', 1)
#     except ValueError:
#         raise ImproperlyConfigured("cannot find class {0}".format(name))
#     imported_module = __import__(module_label, fromlist=[class_name])
#     try:
#         return _pluck_classes([imported_module], [class_name])[0]
#     except IndexError:
#         return None
# 
# def convert_camel_case(name):
#     s1 = FIRST_CAPITAL_PATTERN.sub(r'\1_\2', name)
#     return UPPERCASE_PATTERN.sub(r'\1_\2', s1).lower()


# Path: oscar_mws/fulfillment/adapters.py
from collections import OrderedDict
from django.conf import settings
from ..utils import load_class, convert_camel_case

                product__amazon_profile__isnull=False)

        return [self.get_line_adapter(l) for l in lines]

    def get_fields(self, address=None, **kwargs):
        if address is None:
            address = self.order.shipping_address

        order_fields = {}
        order_fields.update(
            self.get_required_fields(address=address, **kwargs)
        )
        order_fields.update(
            self.get_optional_fields(address=address, **kwargs)
        )
        return order_fields


def get_order_adapter():
    adapter_class = OrderAdapter
    custom_adapter = getattr(settings, 'MWS_ORDER_ADAPTER', None)
    if custom_adapter:
        adapter_class = load_class(custom_adapter)
    return adapter_class


def get_order_line_adapter():
    adapter_class = OrderLineAdapter
    custom_adapter = getattr(settings, 'MWS_ORDER_LINE_ADAPTER', None)
    if custom_adapter:

        adapter_class = load_class(custom_adapter)