<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def sort_items(self,items,args=False):
 """ Sort the `self`'s contents, as contained in the list `items` as specified in `self`'s meta-data. """

    if self.settings['sort'].lower() == 'src': return
    def alpha(i):
        return i.name
    def permission(i):
        if args:
            if i.intent == 'in': return 'b'
            if i.intent == 'inout': return 'c'
            if i.intent == 'out': return 'd'
            if i.intent == '': return 'e'
        perm = getattr(i, 'permission', '')
        if perm == 'public': return 'b'
        if perm == 'protected': return 'c'
        if perm == 'private': return 'd'
        return 'a'
    def permission_alpha(i):
        return permission(i) + '-' + i.name
    def itype(i):
        if i.obj == 'variable':
            retstr = i.vartype
            if retstr == 'class': retstr = 'type'
            if i.kind: retstr = retstr + '-' + str(i.kind)
            if i.strlen: retstr = retstr + '-' + str(i.strlen)
            if i.proto:
                retstr = retstr + '-' + i.proto[0]
            return retstr
        elif i.obj == 'proc':
            if i.proctype != 'Function':
                return i.proctype.lower()
            else:
                return i.proctype.lower() + '-' + itype(i.retvar)
        else:
            return i.obj
    def itype_alpha(i):
        return itype(i) + '-' + i.name

    if self.settings['sort'].lower() == 'alpha':
        items.sort(key=alpha)
    elif self.settings['sort'].lower() == 'permission':
        items.sort(key=permission)
    elif self.settings['sort'].lower() == 'permission-alpha':
        items.sort(key=permission_alpha)
    elif self.settings['sort'].lower() == 'type':
        items.sort(key=itype)
    elif self.settings['sort'].lower() == 'type-alpha':
        items.sort(key=itype_alpha)