Python script as command

I’ve recently found an interesting Python script which randomly rotate objects.
Is it possible to convert it as a command?

Any script can run like a command if you set up a command alias for it.

https://wiki.mcneel.com/rhino/macroscriptsetup