def document_lookup(md_files):
    """
    Given a list of MarkdownDocument files, create a dictionary keyed by
    the filename (independent of the path). It will map the filename to
    a list of potential files.

    # Parameters

    md_files:list(MarkdownDocument)
        - The list of MarkdownDocument objects to create the lookup
        dictionary

    # Return

    A dictionary keyed by a filename mapped to a list of
    MarkdownDocument objects that have that filename but are on
    different paths.

    """

    reverse = {}

    for md in md_files:
        reverse.setdefault(md.filename.name, []).append(md)

    return reverse