def receiveds_parsing(receiveds):
parsed = []<EOL>receiveds = [re.sub(JUNK_PATTERN, "<STR_LIT:U+0020>", i).strip() for i in receiveds]<EOL>n = len(receiveds)<EOL>log.debug("<STR_LIT>".format(n))<EOL>for idx, received in enumerate(receiveds):<EOL><INDENT>log.debug("<STR_LIT>".format(idx + <NUM_LIT:1>, n))<EOL>log.debug("<STR_LIT>".format(received))<EOL>try:<EOL><INDENT>values_by_clause = parse_received(received)<EOL><DEDENT>except MailParserReceivedParsingError:<EOL><INDENT>parsed.append({'<STR_LIT>': received})<EOL><DEDENT>else:<EOL><INDENT>parsed.append(values_by_clause)<EOL><DEDENT><DEDENT>log.debug("<STR_LIT>" % (<EOL>len(receiveds), len(parsed)))<EOL>if len(receiveds) != len(parsed):<EOL><INDENT>log.error("<STR_LIT>" % (len(receiveds), len(parsed), receiveds, parsed))<EOL>return receiveds_not_parsed(receiveds)<EOL><DEDENT>else:<EOL><INDENT>return receiveds_format(parsed)<EOL><DEDENT>
This function parses the receiveds headers.

Args:
    receiveds (list): list of raw receiveds headers

Returns:
    a list of parsed receiveds headers with first hop in first position