I wonder how to check for whitespaces in string. I know about isspace() method, which checks for any whitespace. But what about extra whitespace around string? For example:
def check_string(string):
<...>
return result
check_string(' The string has some whitespace.')
False
check_string(' Extra whitespace is not good. ')
False
check_string('This string is clean')
True