def METHOD_NAME(fileNames, directory=""):
    """This function searches the directory for POOL XML catalog files and extracts the GUID.
    fileNames can be a string or a list, directory defaults to PWD.
    """
    if not directory:
        directory = os.getcwd()
    if not os.path.isdir(directory):
        return S_ERROR(f"{directory} is not a directory")
    if not isinstance(fileNames, list):
        fileNames = [fileNames]
    gLogger.verbose(f"Will look for POOL XML Catalog GUIDs in {directory} for {', '.join(fileNames)}")
    finalCatList = _getPoolCatalogs(directory)
    # Create POOL catalog with final list of catalog files and extract GUIDs
    generated = []
    pfnGUIDs = {}
    catalog = PoolXMLCatalog(finalCatList)
    for fname in fileNames:
        guid = str(catalog.getGuidByPfn(fname))
        if not guid:
            guid = makeGuid(fname)
            generated.append(fname)
        pfnGUIDs[fname] = guid
    if not generated:
        gLogger.info(f"Found GUIDs from POOL XML Catalogue for all files: {', '.join(fileNames)}")
    else:
        gLogger.info(f"GUIDs not found from POOL XML Catalogue (and were generated) for: {', '.join(generated)}")
    result = S_OK(pfnGUIDs)
    result["directory"] = directory
    result["generated"] = generated
    return result