def _duplicate_ndim(param, ndim):
    if (param is None):
        return None
    if (isinstance(param, Sequence) and isinstance(param[0], Sequence)):
        return [[(x if (len(x) > 1) else ((- x[0]), x[0])) for x in y] for y in param]
    if isinstance(param, Sequence):
        param = (((- param[0]), param[0]) if (len(param) == 1) else param)
    else:
        param = ((- param), param)
    return ([param] * ndim)
def _duplicate_ndim(param, ndim):
    if (param is None):
        return None
    if (isinstance(param, Sequence) and isinstance(param[0], Sequence)):
        return [[(x if (len(x) > 1) else ((- x[0]), x[0])) for x in y] for y in param]
    if isinstance(param, Sequence):
        param = (((- param[0]), param[0]) if (len(param) == 1) else param)
    else:
        param = ((- param), param)
    return ([param] * ndim)