protected function getContentType(Part $part)
    {
        if (!$this->hasHeader($part, 'Content-Type')) {
            throw new Exception('This email does not have a content type. Check for that with hasContentType()');
        }

        $zendContentType = $part
            ->getHeaders()
            ->get('Content-Type');

        switch (true) {
            case is_array($zendContentType):
                return $zendContentType[0];
            case $zendContentType instanceof HeaderInterface:
                return $zendContentType;
            case $zendContentType instanceof ArrayIterator:
                return $zendContentType->current();
            default:
                throw new Exception('Unexpected return type ' .
                    gettype($zendContentType) .
                    ', expected one of string, array, HeaderInterface or ArrayIterator' .
                    ' from Part::getHeaders()::get("Content-Type"))'
                );
        }
    }