Downloads the ${run_name}.metadata.tar file from the DNAnexus sequencing results project.
    
        Args: 
            download_dir: `str` - The local directory path to download the QC report to.
        Returns:
            `str`: The filepath to the downloaded metadata tarball.

def download_metadata_tar(self,download_dir):  
        """
        Downloads the ${run_name}.metadata.tar file from the DNAnexus sequencing results project.
    
        Args: 
            download_dir: `str` - The local directory path to download the QC report to.
        Returns:
            `str`: The filepath to the downloaded metadata tarball.
        """
        if not os.path.isdir(download_dir):
            os.makedirs(download_dir)  
        res = dxpy.find_one_data_object(project=self.dx_project_id,folder=self.DX_RAW_DATA_FOLDER,name="*metadata.tar",name_mode="glob")
        #res will be something like {u'project': u'project-BzqVkxj08kVZbPXk54X0P2JY', u'id': u'file-BzqVkg800Fb0z4437GXJfGY6'}
        #dxpy.find_one_data_object() raises a dxpy.exceptions.DXSearchError() if nothing is found.
        dx_file = dxpy.DXFile(dxid=res["id"],project=res["project"])
        download_file_name = os.path.join(download_dir,dx_file.name)
        msg = "{filename} to {download_dir}.".format(filename=dx_file.name,download_dir=download_dir)
        debug_logger.debug("Downloading " + msg)
        dxpy.bindings.dxfile_functions.download_dxfile(dxid=dx_file,filename=download_file_name)
        success_logger.info("Downloaded " + msg)
        return download_file_name