def trim(value, default_value=''):
    """
    Removes leading and trailing whitespace from the specified string. If the specified string is composed of
    whitespace only, the specified default value is returned.

    :param value: a string to trim
    :param default_value: a default value to return if the specified string consists of whitespace only.
    :return: a string without any leading or trailing whitespace or the specified default value if
        the specified string consists of whitespace only.
    """
    value = value.strip() if value else None
    return value if value else default_value
