def _strip_span(span, text):
    """
    Return span after stripping out whitespace on either side of text.
    """
    start = span[0] + len(text) - len(text.lstrip())
    end = span[1] - (len(text) - len(text.rstrip()))
    return start, end