import re


def strip_whitespace(string):
    """strips all whitespace at beginning and end of string"""
    string = re.sub(r"^\s*", "", string)
    string = re.sub(r"\s*$", "", string)
    return string