# Path: pyfive/core.py
# def _padded_size(size, padding_multipe=8):
#     """ Return the size of a field padded to be a multiple a give value. """
#     return int(ceil(size / padding_multipe) * padding_multipe)
# 
# def _structure_size(structure):
#     """ Return the size of a structure in bytes. """
#     fmt = '<' + ''.join(structure.values())
#     return struct.calcsize(fmt)
# 
# def _unpack_struct_from(structure, buf, offset=0):
#     """ Unpack a structure into an OrderedDict from a buffer of bytes. """
#     fmt = '<' + ''.join(structure.values())
#     values = struct.unpack_from(fmt, buf, offset=offset)
#     return OrderedDict(zip(structure.keys(), values))
# 
# Path: pyfive/core.py
# class InvalidHDF5File(Exception):
#     """ Exception raised when an invalid HDF5 file is detected. """
#     pass


from collections import OrderedDict
from .core import _padded_size, _structure_size, _unpack_struct_from
from .core import InvalidHDF5File
        # last 4 bits
        datatype_class = datatype_msg['class_and_version'] & 0x0F

        if datatype_class == DATATYPE_FIXED_POINT:
            return self._determine_dtype_fixed_point(datatype_msg)
        elif datatype_class == DATATYPE_FLOATING_POINT:
            return self._determine_dtype_floating_point(datatype_msg)
        elif datatype_class == DATATYPE_TIME:
            raise NotImplementedError("Time datatype class not supported.")
        elif datatype_class == DATATYPE_STRING:
            return self._determine_dtype_string(datatype_msg)
        elif datatype_class == DATATYPE_BITFIELD:
            raise NotImplementedError("Bitfield datatype class not supported.")
        elif datatype_class == DATATYPE_OPAQUE:
            raise NotImplementedError("Opaque datatype class not supported.")
        elif datatype_class == DATATYPE_COMPOUND:
            return self._determine_dtype_compound(datatype_msg)
        elif datatype_class == DATATYPE_REFERENCE:
            return ('REFERENCE', datatype_msg['size'])
        elif datatype_class == DATATYPE_ENUMERATED:
            raise NotImplementedError(
                "Enumerated datatype class not supported.")
        elif datatype_class == DATATYPE_ARRAY:
            raise NotImplementedError("Array datatype class not supported.")
        elif datatype_class == DATATYPE_VARIABLE_LENGTH:
            vlen_type = self._determine_dtype_vlen(datatype_msg)
            if vlen_type[0] == 'VLEN_SEQUENCE':
                base_type = self.determine_dtype()
                vlen_type = ('VLEN_SEQUENCE', base_type)
            return vlen_type

# Path: pyfive/core.py
# def _padded_size(size, padding_multipe=8):
#     """ Return the size of a field padded to be a multiple a give value. """
#     return int(ceil(size / padding_multipe) * padding_multipe)
# 
# def _structure_size(structure):
#     """ Return the size of a structure in bytes. """
#     fmt = '<' + ''.join(structure.values())
#     return struct.calcsize(fmt)
# 
# def _unpack_struct_from(structure, buf, offset=0):
#     """ Unpack a structure into an OrderedDict from a buffer of bytes. """
#     fmt = '<' + ''.join(structure.values())
#     values = struct.unpack_from(fmt, buf, offset=offset)
#     return OrderedDict(zip(structure.keys(), values))
# 
# Path: pyfive/core.py
# class InvalidHDF5File(Exception):
#     """ Exception raised when an invalid HDF5 file is detected. """
#     pass


# Path: pyfive/datatype_msg.py
from collections import OrderedDict
from .core import _padded_size, _structure_size, _unpack_struct_from
from .core import InvalidHDF5File

        # last 4 bits
        datatype_class = datatype_msg['class_and_version'] & 0x0F

        if datatype_class == DATATYPE_FIXED_POINT:
            return self._determine_dtype_fixed_point(datatype_msg)
        elif datatype_class == DATATYPE_FLOATING_POINT:
            return self._determine_dtype_floating_point(datatype_msg)
        elif datatype_class == DATATYPE_TIME:
            raise NotImplementedError("Time datatype class not supported.")
        elif datatype_class == DATATYPE_STRING:
            return self._determine_dtype_string(datatype_msg)
        elif datatype_class == DATATYPE_BITFIELD:
            raise NotImplementedError("Bitfield datatype class not supported.")
        elif datatype_class == DATATYPE_OPAQUE:
            raise NotImplementedError("Opaque datatype class not supported.")
        elif datatype_class == DATATYPE_COMPOUND:
            return self._determine_dtype_compound(datatype_msg)
        elif datatype_class == DATATYPE_REFERENCE:
            return ('REFERENCE', datatype_msg['size'])
        elif datatype_class == DATATYPE_ENUMERATED:
            raise NotImplementedError(
                "Enumerated datatype class not supported.")
        elif datatype_class == DATATYPE_ARRAY:
            raise NotImplementedError("Array datatype class not supported.")
        elif datatype_class == DATATYPE_VARIABLE_LENGTH:
            vlen_type = self._determine_dtype_vlen(datatype_msg)
            if vlen_type[0] == 'VLEN_SEQUENCE':
                base_type = self.determine_dtype()
                vlen_type = ('VLEN_SEQUENCE', base_type)
            return vlen_type

        raise InvalidHDF5File('Invalid datatype class %i' % (datatype_class))