s = """                                                                    
ssh x.x.x.x cat '| /path/to/bash/script.sh;'
"""
proc = subprocess.Popen(sbash, stdout=subprocess.PIPE, stderr=subprocess.
    PIPE, stdin=subprocess.PIPE)
out, err = proc.communicate(open(fn).read())
Using Python to cat a file over ssh to a remote bash script