def _make_key(args, kwds, typed,<EOL>kwd_mark = (object(),),<EOL>fasttypes = set((int, str, frozenset, type(None))),<EOL>sorted=sorted, tuple=tuple, type=type, len=len):
key = args<EOL>if kwds:<EOL><INDENT>sorted_items = sorted(kwds.items())<EOL>key += kwd_mark<EOL>for item in sorted_items:<EOL><INDENT>key += item<EOL><DEDENT><DEDENT>if typed:<EOL><INDENT>key += tuple(type(v) for v in args)<EOL>if kwds:<EOL><INDENT>key += tuple(type(v) for k, v in sorted_items)<EOL><DEDENT><DEDENT>elif len(key) == <NUM_LIT:1> and type(key[<NUM_LIT:0>]) in fasttypes:<EOL><INDENT>return key[<NUM_LIT:0>]<EOL><DEDENT>return _HashedSeq(key)<EOL>
Make a cache key from optionally typed positional and keyword arguments