def cdriver2filetype(driver):
    """Convert a connection driver to a file type.

    Args:
        driver (str): The name of the connection driver.

    Returns:
        str: The corresponding file type for the driver.

    """
    _legacy = {'FileInputDriver': 'binary', 'FileOutputDriver': 'binary',
        'AsciiMapInputDriver': 'map', 'AsciiMapOutputDriver': 'map',
        'AsciiFileInputDriver': 'ascii', 'AsciiFileOutputDriver': 'ascii',
        'AsciiTableInputDriver': 'table', 'AsciiTableOutputDriver': 'table',
        'PandasFileInputDriver': 'pandas', 'PandasFileOutputDriver':
        'pandas', 'PickleFileInputDriver': 'pickle',
        'PickleFileOutputDriver': 'pickle', 'PlyFileInputDriver': 'ply',
        'PlyFileOutputDriver': 'ply', 'ObjFileInputDriver': 'obj',
        'ObjFileOutputDriver': 'obj', 'MatInputDriver': 'mat',
        'MatOutputDriver': 'mat'}
    if driver in _legacy:
        return _legacy[driver]
    raise ValueError('%s is not a registered connection driver.' % driver)
