<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def allowed_entries(self, capability):
 """Return list of allowed entries for given capability document. Includes handling of capability = *index where the only acceptable entries are *. """

        index = re.match(r'(.+)index$', capability)
        archive = re.match(r'(.+)\-archive$', capability)
        if (capability == 'capabilitylistindex'):
            return([])  # not allowed so no valid references
        elif (index):
            return([index.group(1)])  # name without index ending
        elif (archive):
            return([archive.group(1)])  # name without -archive ending
        elif (capability == 'description'):
            return(['capabilitylist'])
        elif (capability == 'capabilitylist'):
            return(['resourcelist', 'resourcedump',
                    'changelist', 'changedump',
                    'resourcelist-archive', 'resourcedump-archive',
                    'changelist-archive', 'changedump-archive'])
        return([])