<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def export(self, image_path, tmptar=None):
    '''export will export an image, sudo must be used.

       Parameters
       ==========
   
       image_path: full path to image
       tmptar: if defined, use custom temporary path for tar export

    '''
    from spython.utils import check_install
    check_install()

    if tmptar is None:
        tmptar = "/%s/tmptar.tar" %(tempfile.mkdtemp())
    cmd = ['singularity', 'image.export', '-f', tmptar, image_path]

    output = self.run_command(cmd, sudo=False)
    return tmptar