'Returns a random element from a passed object.
If `elements` is a dictionary, the value will be used as
a weighting element. For example::
random_element({"{{variable_1}}": 0.5, "{{variable_2}}": 0.2, "{{variable_3}}": 0.2, "{{variable_4}}": 0.1})
will have the following distribution:
* `variable_1`: 50% probability
* `variable_2`: 20% probability
* `variable_3`: 20% probability
* `variable_4`: 10% probability'

@classmethod
def random_element(cls, elements=('a', 'b', 'c')):

    if isinstance(elements, dict):
        choices = elements.keys()
        probabilities = elements.values()
        return choice_distribution(list(choices), list(probabilities))
    else:
        return random.choice(list(elements))
