<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def secure(pdf, user_pw, owner_pw, restrict_permission=True, pdftk=get_pdftk_path(), output=None):
 """ Encrypt a PDF file and restrict permissions to print only. Utilizes pdftk command line tool. :param pdf: Path to PDF file :param user_pw: Password to open and view :param owner_pw: Password to transform permissions :param restrict_permission: Restrict permissions to print only :param pdftk: Path to pdftk binary :param output: Output path :return: Output path """

    if pdftk:
        # Check that PDF file is encrypted
        with open(pdf, 'rb') as f:
            reader = PdfFileReader(f)
            if reader.isEncrypted:
                print('PDF is already encrypted')
                return pdf

        # Create output filename if not already set
        if not output:
            output = add_suffix(pdf, 'secured')

        # Replace spaces within paths with backslashes followed by a space
        pdf_en = pdf.replace(' ', '\ ')
        output_en = output.replace(' ', '\ ')

        # Concatenate bash command
        command = pdftk + ' ' + pdf_en + ' output ' + output_en + ' owner_pw ' + owner_pw + ' user_pw ' + user_pw

        # Append string to command if printing is allowed
        if restrict_permission:
            command += ' allow printing'

        # Execute command
        os.system(command)
        print('Secured PDF saved to...', output)
        return output
    else:
        print('Unable to locate pdftk binary')