def contains_vendored_imports(python_path):
    """
    Returns True if ``python_path`` seems to contain vendored imports from botocore.
    """
    # We're using a very rough heuristic here: if the source code contains
    # strings that look like a vendored import, we'll flag.
    #
    # Because Python is dynamic, there are lots of ways you could be
    # importing the vendored modules that wouldn't be caught this way, but:
    #
    #   1.  Doing it in a complete foolproof way is incredibly complicated, and
    #       I don't care that much.
    #   2.  If you're writing your Lambda code in a deliberately obfuscated way,
    #       you have bigger problems than vendor deprecations.
    #
    # In practice, Python imports are usually near the top of the file, so we
    # read it line-by-line.  This means if we find an import, we can skip
    # reading the rest of the file.
    #
    with open(python_path, "rb") as python_src:
        for line in python_src:
            if (
                b"import botocore.vendored" in line
                or b"from botocore.vendored import " in line
            ):
                return True

    return False