Get bash output in Python

Here's a function I use all the time in scripts that are better written in Python than in bash, but need to use a bash command or two to get some data. I wrote it specifically for use with list output, but I've used it dozens of times and never wanted to change it.

import subprocess
import tempfile


def get_shell_output(command):
    (tf, tfname) = tempfile.mkstemp()
    (foo, bar) = tempfile.mkstemp()
    subprocess.check_call(command,
                          shell=True,
                          stdout=tf,
                          stderr=foo,
                          close_fds=True)
    f = open(tfname, 'r')
    output = f.readlines()
    f.close()
    output = [a.strip() for a in output]
    return output