def has_def_or_class_statement(line_text):
    """Return whether line starts w/ 'def ' or 'class '.

    Parameters
    ==========
    line_text (string)
        represents contents of a line of Python source.
    """
    ### get the startswith method of the line text after
    ### stripping its beginning from any existing
    ### whitespace
    startswith = line_text.lstrip().startswith

    ### return whether the text starts with either 'def '
    ### or 'class ' substrings or not; the space at the end
    ### of each substring is important, since it means the
    ### 'def' or 'class' portion appears isolated in the
    ### line, not as part of a longer word;

    return any(startswith(substring) for substring in ("def ", "class "))
Return whether line starts w/ 'def ' or 'class '.

    Parameters
    ==========
    line_text (string)
        represents contents of a line of Python source.
    
nodezator/syntaxman/syntaxes/python/utils.py