def get_required_values(generator, field):
    """
    Gets required values for a generator from the field.
    If required value is a function, calls it with field as argument.
    If required value is a string, simply fetch the value from the field
    and return.
    """
    rt = {}
    if hasattr(generator, 'required'):
        for item in generator.required:
            if callable(item):
                key, value = item(field)
                rt[key] = value
            elif isinstance(item, str):
                rt[item] = getattr(field, item)
            else:
                raise ValueError(
                    "Required value '%s' is of wrong type.                                   Don't make mommy sad."
                     % str(item))
    return rt
