def _bounds_vars_for_variable(ncfile, ncvar):
    """Return a list of names for a variable and its bounds"""

    variables = [ncvar.varname]

    if "cell_methods" not in ncvar.attrs:
        # no cell methods, so no need to look for bounds
        return variables

    # [cell methods] is a string attribute comprising a list of
    # blank-separated words of the form "name: method"
    cell_methods = iter(ncvar.attrs["cell_methods"].split())

    # for the moment, we're only looking for a time mean
    for dim, method in zip(cell_methods, cell_methods):
        if not (dim[:-1] == "time" and method == "mean"):
            continue

    bounds_var = ncfile.ncvars["time"].attrs.get("bounds")
    if bounds_var is not None:
        variables.append(bounds_var)

    return variables