def addresses(self):
        """
        Return a ``dict`` containing a billing and a shipping address, taking
        into account the value of the ``shipping_same_as_billing`` flag
        """
        billing = dict(
            (f, getattr(self, 'billing_%s' % f)) for f in self.ADDRESS_FIELDS)

        if self.shipping_same_as_billing:
            shipping = billing
        else:
            shipping = dict(
                (f, getattr(self, 'shipping_%s' % f))
                for f in self.ADDRESS_FIELDS)

        return {'billing': billing, 'shipping': shipping}
dataset/ETHPy150Open matthiask/plata/plata/shop/models.py/BillingShippingAddress.addresses/original