<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write_tabular(obj, filepath):
 """Write tabular object in HDF5 or pickle format Args: obj (array or DataFrame):
 tabular object to write filepath (path-like):
 path to write to; must end in '.h5' or '.pkl' """

    _, fn, ext = splitext2(filepath)
    if ext == '.h5':
        _write_tabular_h5(obj, filepath)
    elif ext == '.pkl':
        _write_tabular_pickle(obj, filepath)
    else:
        raise NotImplementedError