def validate_keys(name, d, keys):
    """
    Assert that all keys exist in d, and that they are non-empty strings.
    If any invalid keys found, raise TypeError.
    """
    try:
        for key in keys:
            assert isinstance(d[key], str)
            assert len(d[key]) > 0
    except TypeError:
        raise TypeError(f'{name} is not a dict')
    except KeyError:
        raise TypeError(
            f"Missing dict keys for {name}. Expecting: {', '.join(keys)}")
    except AssertionError:
        raise TypeError(
            f'Invalid key values for {name}. Keys must be non-empty strings.')
    return True
