def str2val(val, format="%5.2f", na="na", list_detection=False):
    """guess type (int, float) of value.

    If `val` is neither int nor float, the value
    itself is returned.
    """

    if val is None:
        return val

    def _convert(v):
        try:
            x = int(v)
        except __HOLE__:
            try:
                x = float(v)
            except ValueError:
                return v
        return x

    if list_detection and "," in val:
        return [_convert(v) for v in val.split(",")]
    else:
        return _convert(val)
dataset/ETHPy150Open CGATOxford/cgat/CGAT/IOTools.py/str2val