<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def enrich_git_log_dict(messages, labels):
 """Enrich git log with related information on tickets."""

    for commit_sha1, message in messages.items():
        # detect module and ticket numbers for each commit:
        component = None
        title = message.split('\n')[0]
        try:
            component, title = title.split(":", 1)
            component = component.strip()
        except ValueError:
            pass  # noqa

        paragraphs = [analyse_body_paragraph(p, labels)
                      for p in message.split('\n\n')]
        yield {
            'sha1': commit_sha1,
            'component': component,
            'title': title.strip(),
            'tickets': re.findall(r'\s(#\d+)', message),
            'paragraphs': [
                (label, remove_ticket_directives(message))
                for label, message in paragraphs
            ],
        }