def set_default_from_schema(instance, schema):
    """
    Populate default values on an `instance` given a `schema`.

    Parameters
    ----------
    instance : dict
        instance to populate default values for
    schema : dict
        JSON schema with default values

    Returns
    -------
    instance : dict
        instance with populated default values
    """
    for name, property_ in schema.get('properties', {}).items():
        # Set the defaults at this level of the schema
        if 'default' in property_:
            instance.setdefault(name, property_['default'])
        # Descend one level if the property is an object
        if 'properties' in property_:
            set_default_from_schema(instance.setdefault(name, {}), property_)
    return instance