def ensure_object_is_string(item, title):
    """
    Checks that the item is a string. If not, raises ValueError.
    """
    assert isinstance(title, str)
    if not isinstance(item, str):
        msg = '{} must be a string. {} passed instead.'
        raise TypeError(msg.format(title, type(item)))
    return None
