def fmt_map(dtype):
    """Map dataformat.

    :param dtype: the dtype of the data
    :type dtype: str
    :return: the mapping format
    :rtype: str
    """
    if dtype == "float32":
        fmt = "f"
    elif dtype == "int64":
        fmt = "q"
    else:
        raise ValueError("The dtype should be float32 or int64.")
    return fmt