def check_param(var, datatype):
    """Checks if a variable is the correct data type.

    If it's not correct, return the error message to raise.

    Parameters
    -----------
    var
        the variable to check.

    datatype
        the data type to compare against.


    Returns
    ----------
    str
        the error message to raise.
    """
    if isinstance(var, datatype):
        return ''
    return f"{[name for name, value in locals().items() if var == value][0]} expects '{datatype.__name__}' not '{type(var)}'"