<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def run_dssp(pdb, path=True, outfile=None):
 """Uses DSSP to find helices and extracts helices from a pdb file or string. Parameters pdb : str Path to pdb file or string. path : bool, optional Indicates if pdb is a path or a string. outfile : str, optional Filepath for storing the dssp output. Returns ------- dssp_out : str Std out from DSSP. """

    if not path:
        if type(pdb) == str:
            pdb = pdb.encode()
        try:
            temp_pdb = tempfile.NamedTemporaryFile(delete=False)
            temp_pdb.write(pdb)
            temp_pdb.seek(0)
            dssp_out = subprocess.check_output(
                [global_settings['dssp']['path'], temp_pdb.name])
            temp_pdb.close()
        finally:
            os.remove(temp_pdb.name)
    else:
        dssp_out = subprocess.check_output(
            [global_settings['dssp']['path'], pdb])

    # Python 3 string formatting.
    dssp_out = dssp_out.decode()

    if outfile:
        with open(outfile, 'w') as outf:
            outf.write(dssp_out)
    return dssp_out