def find_sqltype(val):
    """
    Find sqlite data type which matches the type of `val`.

    Parameters
    ----------
    val : any python type

    Returns
    -------
    sqltype : str
        String with sql type which can be used to set up a sqlile table
    """
    mapping = {\
        type(None): 'NULL',
        int:        'INTEGER',
        float:      'REAL',  # 'FLOAT' also works
        str:        'TEXT',
        memoryview: 'BLOB'}
    for typ in mapping:
        if isinstance(val, typ):
            return mapping[typ]
    raise Exception("type '%s' unknown, cannot find mapping "
        "to sqlite3 type" %str(type(val)))