import random


def cross(a, b, random=random):
    """Create a new set of genes.  Each gene is randomly selected from one of the parents."""
    return { key : random.choice([a,b])[key] for key in a.keys() }