def _contains_only_spaces(string):
    """
    Check if a string contains only whitespaces.

    :param string: String to check.
    :return: True/False whether or not the string contains only whitespaces.
    """
    return string.replace(' ', '') == ""