def tuplize_key(obj, key, remove_extra=False):
paramlen = len(obj.formula.parameters)<EOL>if isinstance(key, str):<EOL><INDENT>key = (key,)<EOL><DEDENT>elif not isinstance(key, Sequence):<EOL><INDENT>key = (key,)<EOL><DEDENT>if not remove_extra:<EOL><INDENT>return key<EOL><DEDENT>else:<EOL><INDENT>arglen = len(key)<EOL>if arglen:<EOL><INDENT>return key[: min(arglen, paramlen)]<EOL><DEDENT>else:<EOL><INDENT>return key<EOL><DEDENT><DEDENT>
Args