diff --git a/components/prism-python.js b/components/prism-python.js
index <HASH>..<HASH> 100644
--- a/components/prism-python.js
+++ b/components/prism-python.js
@@ -12,7 +12,7 @@ Prism.languages.python= {
 		greedy: true
 	},
 	'function' : {
-		pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_][a-zA-Z0-9_]*(?=\()/g,
+		pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_][a-zA-Z0-9_]*(?=\s*\()/g,
 		lookbehind: true
 	},
 	'class-name': {
Python: Add highlighting to functions with space between name and parentheses