Given two collections ``a`` and ``b``, this will return the *median* of all
    distances. ``distance_function`` is used to determine the distance between
    two elements.

    Example::

        >>> single([1, 2], [3, 100], lambda x, y: abs(x-y))
        2.5

def uclus(a, b, distance_function):
    """
    Given two collections ``a`` and ``b``, this will return the *median* of all
    distances. ``distance_function`` is used to determine the distance between
    two elements.

    Example::

        >>> single([1, 2], [3, 100], lambda x, y: abs(x-y))
        2.5
    """
    distances = sorted([distance_function(x, y)
                        for x in a for y in b])
    midpoint, rest = len(distances) // 2, len(distances) % 2
    if not rest:
        return sum(distances[midpoint-1:midpoint+1]) / 2
    else:
        return distances[midpoint]