Searches for the project in DNAnexus based on the input arguments when instantiating the class. 
        If multiple projects are found based on the search criteria, an exception will be raised. A 
        few various search strategies are employed, based on the input arguments. In all cases, if the 
        'billing_account_id' was specifed, all searches will search for projects only belonging to the 
        specified billing account. The search strategies work as follows: If the project ID was
        provided, the search will attempt to find the project by ID only. If the project ID wasn't 
        provided, but the project name was specified, then the search will attempt to find the project
        by name and by any project properties that may have been set during instantiation 
        (uhts_run_name, sequencing_lane, and library_name). If neither the project name nor the 
        project ID was specified, then a search by whichever project properties were specified will take place.
    
        This method will not set the self.dx_project_id if none of the search methods are successful 
        in finding a single project, and this may indicate that the sequencing hasn't finished yet.
    
        Args:
            latest_project: `bool`. True indicates that if multiple projects are found given the search 
            criteria, the most recently created project will be returned.
    
        Returns: 
            `str`. The DNAnexus project ID or the empty string if a project wasn't found.
     
        Raises: 
            `scgpm_seqresults_dnanexus.dnanexus_utils.DxMultipleProjectsWithSameLibraryName()`: The 
                search is by self.library_name, and multiple DNAnexus projects have that library name.

            `DxMissingLibraryNameProperty`: The DNAnexus project property 'library_name' is not present.

def _set_dxproject_id(self,latest_project=False):
        """
        Searches for the project in DNAnexus based on the input arguments when instantiating the class. 
        If multiple projects are found based on the search criteria, an exception will be raised. A 
        few various search strategies are employed, based on the input arguments. In all cases, if the 
        'billing_account_id' was specifed, all searches will search for projects only belonging to the 
        specified billing account. The search strategies work as follows: If the project ID was
        provided, the search will attempt to find the project by ID only. If the project ID wasn't 
        provided, but the project name was specified, then the search will attempt to find the project
        by name and by any project properties that may have been set during instantiation 
        (uhts_run_name, sequencing_lane, and library_name). If neither the project name nor the 
        project ID was specified, then a search by whichever project properties were specified will take place.
    
        This method will not set the self.dx_project_id if none of the search methods are successful 
        in finding a single project, and this may indicate that the sequencing hasn't finished yet.
    
        Args:
            latest_project: `bool`. True indicates that if multiple projects are found given the search 
            criteria, the most recently created project will be returned.
    
        Returns: 
            `str`. The DNAnexus project ID or the empty string if a project wasn't found.
     
        Raises: 
            `scgpm_seqresults_dnanexus.dnanexus_utils.DxMultipleProjectsWithSameLibraryName()`: The 
                search is by self.library_name, and multiple DNAnexus projects have that library name.

            `DxMissingLibraryNameProperty`: The DNAnexus project property 'library_name' is not present. 
        """
        dx_project_props = {}
        if self.library_name:
            dx_project_props["library_name"] = self.library_name
        if self.uhts_run_name:
            dx_project_props["seq_run_name"] = self.uhts_run_name
        if self.sequencing_lane:
            dx_project_props["seq_lane_index"] = str(self.sequencing_lane)
    
        dx_proj = ""
        if self.dx_project_id:
            prefix = "project-"
            if not self.dx_project_id.startswith(prefix):
                self.dx_project_id = prefix + self.dx_project_id
            dx_proj = dxpy.DXProject(dxid=self.dx_project_id)
        elif self.dx_project_name:
            res = dxpy.find_one_project(properties=dx_project_props,billed_to=self.billing_account_id,zero_ok=True,more_ok=False,name=self.dx_project_name)
            if res:
                dx_proj = dxpy.DXProject(dxid=res["id"])
        else:
            #try to find by library_name and potential uhts_run_name
            res = list(dxpy.find_projects(properties=dx_project_props,billed_to=self.billing_account_id))
            if len(res) == 1:
                dx_proj = dxpy.DXProject(dxid=res[0]["id"])
            elif len(res) > 1:
                dx_proj_ids = [x["id"] for x in res]
                if not latest_project:
                    raise DxMultipleProjectsWithSameLibraryName("Error - Multiple DNAnexus projects have the same value for the library_name property value of {library_name}. The projects are {dx_proj_ids}.".format(library_name=self.library_name,dx_proj_ids=dx_proj_ids))
                dx_proj = gbsc_dnanexus.utils.select_newest_project(dx_project_ids=dx_proj_ids)
    
        if not dx_proj:
              return
    
        self.dx_project = dx_proj
        self.dx_project_id = dx_proj.id
        self.dx_project_name = dx_proj.name
        self.dx_project_props = dxpy.api.project_describe(object_id=dx_proj.id,input_params={"fields": {"properties": True}})["properties"]
        try:
            self.library_name = self.dx_project_props["library_name"]
        except KeyError:
            msg = "DNAnexus project {} is missing the library_name property.".format(self.dx_project_name)
            raise DxMissingLibraryNameProperty(msg)