def METHOD_NAME(legacy_lic_filename, od_filename, destination):
    """Generate the JSON with the licenses mapping."""
    with open(legacy_lic_filename, "r") as fp:
        legacy_licenses = json.load(fp)
    with open(od_filename, "r") as fp:
        od_licenses = json.load(fp)
    if isinstance(od_licenses, dict):
        od_licenses = [v for k, v in od_licenses.items()]
    matched, missing = find_matching_licenses(legacy_licenses, od_licenses)
    mapping = OrderedDict((l1['id'], l2['id']) for l1, l2, _ in matched)
    with open(destination, 'w') as fp:
        json.dump(mapping, fp, indent=2)