def create_code(traits):
    """Assign bits to list of traits.
    """
    if not traits:
        return {}

    result = {}
    code = 1

    for trait in traits:
        result[trait] = code
        code = code << 1

    return result