Pygments has something close : http://pygments.org/docs/quickstart/#lexer-and-formatter-lookup
>>> from pygments.lexers import guess_lexer, guess_lexer_for_filename
>>> guess_lexer('#!/usr/bin/python\nprint "Hello World!"')
<pygments.lexers.PythonLexer>
Not perfect but quite useful already.
But yeah I share your frustration with paste service, had the same. In my opinion actually the coloration should be done client side.
https://github.com/alexgorbatchev/SyntaxHighlighter
http://code.google.com/p/google-code-prettify/
are pretty nice in that regard.