<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def dicts_from_lines(lines):
 """ returns a generator producing dicts from json lines 1 JSON object per line is supported: {"name": "n1"} {"name": "n2"} Or 1 JSON object: { "name": "n1" } Or a list of JSON objects: [ {"name": "n1"}, {"name": "n2"}, ] """

    lines = iter(lines)
    for line in lines:
        line = line.strip()
        if not line:
            continue  # skip empty lines
        try:
            yield json.loads(line, object_pairs_hook=OrderedDict)
        except json.decoder.JSONDecodeError:
            content = line + ''.join(lines)
            dicts = json.loads(content, object_pairs_hook=OrderedDict)
            if isinstance(dicts, list):
                yield from dicts
            else:
                yield dicts