def list_intersection(a_list, b_list, transform=lambda element : element):
    """Return a list of the intersection of two lists.

    Parameters
    ----------
    a_list : sequence
        First list. The order of the returned list is determined by this list.

    b_list : sequence or set
        Second list.


    Returns
    -------
    result : list
        The intersection of the input lists with the transformation performed
        on each element

    Other Parameters
    ----------------
    transform : function(element)
        A function to perform on each element while the intersection is 
        being executed.

"""

    # Convert the second list to a set, if necessary
    b_set = b_list
    if not isinstance(b_set, set):
        b_set = set(b_list)

    # Do the intersection and return a list.
    result = [transform(value) for value in a_list
              if transform(value) in b_set]

    return result