def load_jsonl(filename):
    try:
        with filename.open() as f:
            lines = list(f.readlines())
        records = []
        for (index, line) in enumerate(lines):
            try:
                records.append(json.loads(line))
            except Exception:
                if (index == (len(lines) - 1)):
                    continue
                raise ValueError(f'Skipping invalid JSON line ({(index + 1)}/{(len(lines) + 1)}) in{filename}: {line}')
        return pd.DataFrame(records)
    except ValueError as e:
        print('Invalid', filename, e)
        return None
def load_jsonl(filename):
    try:
        with filename.open() as f:
            lines = list(f.readlines())
        records = []
        for (index, line) in enumerate(lines):
            try:
                records.append(json.loads(line))
            except Exception:
                if (index == (len(lines) - 1)):
                    continue
                raise ValueError(f'Skipping invalid JSON line ({(index + 1)}/{(len(lines) + 1)}) in{filename}: {line}')
        return pd.DataFrame(records)
    except ValueError as e:
        print('Invalid', filename, e)
        return None