def get_default_value(schema, key, count=None):
    """Get the default value for a key in a schema.

    Parameters
    ----------
    schema : dict[dict]
        Schema to compare to
    key : str
        Key to look for in the schema.
    count : int, optional
        For default functions that return different values, the number of values to
        return. By default, only a single value is returned.

    Returns
    -------
    default_value
        The default value parsed from the schema.

    Raises
    ------
    ValueError
        If a default value does not exist for this key in the schema.
    """
    schema_info = schema[key]
    if schema_info.get('required', False):
        # Key is required, but not available.
        raise ValueError(f"Key '{key}' is required.")
    if 'default' in schema_info:
        return schema_info['default']
    if 'default_function' in schema_info:
        if count is None:
            return schema_info['default_function']()
        else:
            return [schema_info['default_function']() for i in range(count)]
    else:
        raise ValueError(f"Invalid schema: key '{key}' not required and no "
                         "default value!")