@staticmethod
def _make_device_info_dictionary(index, device_info):
    """
        Internal method to create Device Info dictionary that mirrors
        PortAudio's ``PaDeviceInfo`` structure.

        :rtype: dict
        """
    device_name = device_info.name
    for codec in ['utf-8', 'cp1252']:
        try:
            device_name = device_name.decode(codec)
            break
        except:
            pass
    return {'index': index, 'structVersion': device_info.structVersion,
        'name': device_name, 'hostApi': device_info.hostApi,
        'maxInputChannels': device_info.maxInputChannels,
        'maxOutputChannels': device_info.maxOutputChannels,
        'defaultLowInputLatency': device_info.defaultLowInputLatency,
        'defaultLowOutputLatency': device_info.defaultLowOutputLatency,
        'defaultHighInputLatency': device_info.defaultHighInputLatency,
        'defaultHighOutputLatency': device_info.defaultHighOutputLatency,
        'defaultSampleRate': device_info.defaultSampleRate}
