diff --git a/gtksourceview/language-specs/python.lang b/gtksourceview/language-specs/python.lang
index 986cbb3..21ab6b6 100644
--- a/gtksourceview/language-specs/python.lang
+++ b/gtksourceview/language-specs/python.lang
@@ -5,6 +5,7 @@
  Copyright (C) 2003 Gustavo Giráldez <gustavo.giraldez@gmx.net>
  Copyright (C) 2004 Benoît Dejean <TaZForEver@free.fr>
  Copyright (C) 2006 Steve Frécinaux <nud@apinc.org>
+ Copyright (C) 2010 Patryk Zawadzki <patrys@pld-linux.org>
 
  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Library General Public
@@ -46,12 +47,22 @@
     <style id="builtin-constant"  _name="Builtin Constant"      map-to="def:special-constant"/>
     <style id="builtin-object"    _name="Builtin Object"        map-to="def:type"/>
     <style id="builtin-function"  _name="Builtin Function"      map-to="def:builtin"/>
+    <style id="decorator"         _name="Decorator"             map-to="def:preprocessor"/>
+    <style id="function"          _name="Function"              map-to="def:function"/>
+    <style id="class"             _name="Class"                 map-to="def:function"/>
   </styles>
 
   <definitions>
     <define-regex id="identifier">[_a-zA-Z][_a-zA-Z0-9]*</define-regex>
     <define-regex id="number">[1-9][0-9]*</define-regex>
 
+    <define-regex id="identifier-path" extended="true">
+        (\%{identifier}\.)*\%{identifier}
+    </define-regex>
+    <define-regex id="relative-path" extended="true">
+        (\.*\%{identifier-path}|\.+)
+    </define-regex>
+
     <!-- http://docs.python.org/lib/typesseq-strings.html -->
     <context id="format" style-ref="format" extend-parent="false">
       <match extended="true">
@@ -217,17 +228,57 @@
 
         <context id="module-handler" style-ref="module-handler">
           <keyword>import</keyword>
-          <keyword>from</keyword>
           <keyword>as</keyword>
         </context>
 
+        <context id="module-handler-from">
+          <match extended="true">
+            (from)
+            \s+
+            (\%{relative-path})
+          </match>
+          <include>
+            <context sub-pattern="1" style-ref="module-handler"/>
+            <context sub-pattern="2" style-ref="class"/>
+          </include>
+        </context>
+
+        <context id="function-definition">
+          <match extended="true">
+            (def)
+            \s+
+            (\%{identifier})
+          </match>
+          <include>
+            <context sub-pattern="1" style-ref="keyword"/>
+            <context sub-pattern="2" style-ref="function"/>
+          </include>
+        </context>
+
+        <context id="class-definition">
+          <match extended="true">
+            (class)
+            \s+
+            (\%{identifier})
+          </match>
+          <include>
+            <context sub-pattern="1" style-ref="keyword"/>
+            <context sub-pattern="2" style-ref="class"/>
+          </include>
+        </context>
+
+        <context id="decorator" style-ref="decorator">
+          <match extended="true">
+            @
+            \%{identifier-path}
+          </match>
+        </context>
+
         <context id="keyword" style-ref="keyword">
           <keyword>and</keyword>
           <keyword>assert</keyword>
           <keyword>break</keyword>
-          <keyword>class</keyword>
           <keyword>continue</keyword>
-          <keyword>def</keyword>
           <keyword>del</keyword>
           <keyword>elif</keyword>
           <keyword>else</keyword>
