<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _deleteFile(self,directory,fn,dentry,db,service):
 """Deletets file and changes status to '?' if no more services manages the file """

        # FIXME : can switch back to only managing once service
        # at a time
        logger.debug("%s - Deleting"%(fn))

        if fn not in db:
            print("%s - rm: Not in DB, can't remove !"%(fn))
            return False

        # Build up list of names
        servicenames=db[fn]['services'].keys()
        # If service is none, build list of all services
        # to perform this action on
        if service is None:
            servicelist=servicenames
        else:
            servicelist=[service]

        for service in servicelist:
            if not db[fn]['services'].has_key(service):
                print("%s - Can't delete, service [%s] unknown"%(service))
                continue

            if db[fn]['services'][service]['status']!=self.ST_DELETED:
                print("%s - rm: Can't remove file with non 'D' status (%s)!"\
                        %(fn,service))
                continue

            # Only change status if correctly deleted
            if self.sman.GetServiceObj(service).Remove(directory,fn):
                # Delete our service entry
                del db[fn]['services'][service]
                logger.debug('%s - deleted by service: %s'%(fn,service))
            else:
                logger.error('%s - Failed to delete by service: %s'%(fn,service))
                continue

        # Delete whole entry if no services manage it any more
        if len(db[fn]['services'].keys())==0:
            del db[fn]

        return True