import re


def strip_quotations(source_code):
    """
    Strips quotations from code to prevent false positives due to keywords
    inside strings.

    First the function matches groups of quotations by looking for text within
    quotations (not escaped quotations). Then it replaces every group with an
    empty string.

    :param source_code: the string that contains source code
    :return: same source code as source_code but without any quoted strings
    """

    # based on regex from
    # http://stackoverflow.com/questions/171480/regex-grabbing-values-between-quotation-marks
    quotation_regex = "([\"'])(?:(?=(\\\\?))\\2.)*?\\1"
    return re.sub(quotation_regex, "", source_code)