public static function formatAddress(array $address, $sep = ', ')
    {
        $address = array_merge(
            [
                'firstname' => '',
                'lastname' => '',
                'address1' => '',
                'address2' => '',
                'address3' => '',
                'postcode' => '',
                'city' => '',
                'country_code' => '',
            ],
            $address
        );

        $values = array_map('trim', [
                sprintf('%s %s', $address['firstname'], $address['lastname']),
                $address['address1'],
                $address['address2'],
                $address['address3'],
                $address['postcode'],
                $address['city'],
            ]);

        foreach ($values as $key => $val) {
            if (!$val) {
                unset($values[$key]);
            }
        }

        $fullAddress = implode($sep, $values);

        if ($countryCode = trim($address['country_code'])) {
            if ($fullAddress) {
                $fullAddress .= ' ';
            }

            $fullAddress .= sprintf('(%s)', $countryCode);
        }

        return $fullAddress;
    }