<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def passphrase_file(passphrase=None):
 """Read passphrase from a file. This should only ever be used by our built in integration tests. At this time, during normal operation, only pinentry is supported for entry of passwords."""

    cmd = []
    pass_file = None
    if not passphrase and 'CRYPTORITO_PASSPHRASE_FILE' in os.environ:
        pass_file = os.environ['CRYPTORITO_PASSPHRASE_FILE']
        if not os.path.isfile(pass_file):
            raise CryptoritoError('CRYPTORITO_PASSPHRASE_FILE is invalid')
    elif passphrase:
        tmpdir = ensure_tmpdir()
        pass_file = "%s/p_pass" % tmpdir
        p_handle = open(pass_file, 'w')
        p_handle.write(passphrase)
        p_handle.close()

    if pass_file:
        cmd = cmd + ["--batch", "--passphrase-file", pass_file]

        vsn = gpg_version()
        if vsn[0] >= 2 and vsn[1] >= 1:
            cmd = cmd + ["--pinentry-mode", "loopback"]

    return cmd