def assert_hashable(*args, **kw):
try:<EOL><INDENT>for i, arg in enumerate(args):<EOL><INDENT>hash(arg)<EOL><DEDENT><DEDENT>except TypeError:<EOL><INDENT>raise TypeError('<STR_LIT>' % (i, arg))<EOL><DEDENT>try:<EOL><INDENT>for key, val in iterate_items(kw):<EOL><INDENT>hash(val)<EOL><DEDENT><DEDENT>except TypeError:<EOL><INDENT>raise TypeError('<STR_LIT>' % (key, val))<EOL><DEDENT>
Verify that each argument is hashable.

    Passes silently if successful. Raises descriptive TypeError otherwise.

    Example::

        >>> assert_hashable(1, 'foo', bar='baz')
        >>> assert_hashable(1, [], baz='baz')
        Traceback (most recent call last):
          ...
        TypeError: Argument in position 1 is not hashable: []
        >>> assert_hashable(1, 'foo', bar=[])
        Traceback (most recent call last):
          ...
        TypeError: Keyword argument 'bar' is not hashable: []