def file2iter(filename, encoding='utf-8', comment_prefix="#",
              skip_empty_line=True):
    """
        json stream parsing or line parsing
    """
    ret = list()
    visited = set()
    with codecs.open(filename, encoding=encoding) as f:
        for line in f:
            line = line.strip()
            # skip empty line
            if skip_empty_line and len(line) == 0:
                continue

            # skip comment line
            if comment_prefix and line.startswith(comment_prefix):
                continue

            yield line
json stream parsing or line parsing