def ispyfile(filename):
    "ispyfile(filename) ... The file is python source file."
    assert isinstance(filename, str) and filename
    return filename.endswith('.py') and os.path.isfile(filename)
ispyfile(filename) ... The file is python source file.
recipes/Python/435694_Evaluate_upperletters_variable_name_constants/recipe-435694.py