code: def exec_command(attr, cmd):
      
      import subprocess
  
      p = popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
      out, err = p.communicate()
  
      if p.returncode:
          from rez.exceptions import InvalidPackageError
          raise InvalidPackageError(
              "Error determining package attribute '%s':\n%s" % (attr, err))
  
      return out.strip(), err.strip()
docs: Runs a subproc to calculate a package attribute.