<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def generate_dict_schema(size, valid):
 """ Generate a schema dict of size `size` using library `lib`. In addition, it returns samples generator :param size: Schema size :type size: int :param samples: The number of samples to generate :type samples: int :param valid: Generate valid samples? :type valid: bool :returns """


    schema = {}
    generator_items = []

    # Generate schema
    for i in range(0, size):
        while True:
            key_schema,   key_generator   = generate_random_schema(valid)
            if key_schema not in schema:
                break
        value_schema, value_generator = generate_random_schema(valid)

        schema[key_schema] = value_schema
        generator_items.append((key_generator, value_generator))

    # Samples
    generator = ({next(k_gen): next(v_gen) for k_gen, v_gen in generator_items} for i in itertools.count())

    # Finish
    return schema, generator