import random


def weighted_random_selection(obj1, obj2):
    """Randomly return one of the following, obj1 or obj2

    :arg obj1: An instance of class AbstractGameUnit. It can be any object.
               The calling code should ensure the correct object is passed
               to this function.
    :arg obj2: Another instance of class AbstractGameUnit

    :return: obj1 or obj2

    .. seealso:: :py:func:`weighted_random_selection_alternate` which is an
                  alternative implementation that is used to demonstrate
                  the importance of unit testing.
    """
    selection = random.choices([id(obj1), id(obj2)], weights=[0.3, 0.7])
    if selection[0] == id(obj1):
        return obj1
    return obj2