import maya.cmds as cmds

def getFilteredList(list=[], pfx='', sfx=''):
    filteredList = []
    for item in list:
        cond = False
        if pfx and not sfx: cond = item.startswith(pfx)
        if not pfx and sfx: cond = item.endswith(sfx)
        if pfx and sfx: cond = item.startswith(pfx) and item.endswith(sfx)
        if cond: filteredList.append(item)
    return filteredList
