You need to use the command attribute, like so: <param name="port" command="identify_port.py device1" />. This will set the output of your script as the value of port.
Don't forget that the script should be in your PATH and have execute permission.