import re


def offset(text):
    """Returns index of first non-whitespace character.

    Args:
        text (str): string to be analyzed for whitespaces.

    Returns:
        index (int): index of first non-whitespace character; -1 if none found.
    """

    index = 0 # Assume first character is not a whitespace

    # \s == whitespace character, ^\s == NOT whitespace character
    match = re.search(r'[^\s]', text, re.IGNORECASE)

    # -1 only really possible if whole text is blank or made of whitespace
    # characters
    index = match.start() if match else -1

    return index