def _ensure_has_len(seq):
try:<EOL><INDENT>len(seq)<EOL><DEDENT>except TypeError:<EOL><INDENT>return list(seq)<EOL><DEDENT>else:<EOL><INDENT>return seq<EOL><DEDENT>
If seq is an iterator, put its values into a list.