def dataframe_select(df, *cols, **filters):
ii = np.ones(len(df), dtype='<STR_LIT:bool>')<EOL>for (k,v) in six.iteritems(filters):<EOL><INDENT>vals = df[k].values<EOL>if   pimms.is_set(v):                    jj = np.isin(vals, list(v))<EOL>elif pimms.is_vector(v) and len(v) == <NUM_LIT:2>: jj = (v[<NUM_LIT:0>] <= vals) & (vals < v[<NUM_LIT:1>])<EOL>elif pimms.is_vector(v):                 jj = np.isin(vals, list(v))<EOL>else:                                    jj = (vals == v)<EOL>ii = np.logical_and(ii, jj)<EOL><DEDENT>if len(ii) != np.sum(ii): df = df.loc[ii]<EOL>if len(cols) > <NUM_LIT:0>: df = df[list(cols)]<EOL>return df<EOL>
dataframe_select(df, k1=v1, k2=v2...) yields df after selecting all the columns in which the
  given keys (k1, k2, etc.) have been selected such that the associated columns in the dataframe
  contain only the rows whose cells match the given values.
dataframe_select(df, col1, col2...) selects the given columns.
dataframe_select(df, col1, col2..., k1=v1, k2=v2...) selects both.

If a value is a tuple/list of 2 elements, then it is considered a range where cells must fall
between the values. If value is a tuple/list of more than 2 elements or is a set of any length
then it is a list of values, any one of which can match the cell.