A script for organizing 2.5x materials alphabetically

Is there anyone who would care to do a script to organize alphabetically the materials associated with an object? This would be great, just like for Vertex Groups :slight_smile: