<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def has_abiext(self, ext, single_file=True):
 """ Returns the absolute path of the ABINIT file with extension ext. Support both Fortran files and netcdf files. In the later case, we check whether a file with extension ext + ".nc" is present in the directory. Returns empty string is file is not present. Raises: `ValueError` if multiple files with the given ext are found. This implies that this method is not compatible with multiple datasets. """

        if ext != "abo":
            ext = ext if ext.startswith('_') else '_' + ext

        files = []
        for f in self.list_filepaths():
            # For the time being, we ignore DDB files in nc format.
            if ext == "_DDB" and f.endswith(".nc"): continue
            # Ignore BSE text files e.g. GW_NLF_MDF
            if ext == "_MDF" and not f.endswith(".nc"): continue
            # Ignore DDK.nc files (temporary workaround for v8.8.2 in which
            # the DFPT code produces a new file with DDK.nc extension that enters
            # into conflict with AbiPy convention.
            if ext == "_DDK" and f.endswith(".nc"): continue

            if f.endswith(ext) or f.endswith(ext + ".nc"):
                files.append(f)

        # This should fix the problem with the 1WF files in which the file extension convention is broken
        if not files:
            files = [f for f in self.list_filepaths() if fnmatch(f, "*%s*" % ext)]

        if not files:
            return ""

        if len(files) > 1 and single_file:
            # ABINIT users must learn that multiple datasets are bad!
            raise ValueError("Found multiple files with the same extensions:\n %s\n" % files +
                             "Please avoid using multiple datasets!")

        return files[0] if single_file else files