def has_folder(portaladmin, username, foldername):
    ''' Determines if folder already exists '''
    exists = False
    portal_folders = []
    for portal_folder in portaladmin.folders(username):
        portal_folders.append(portal_folder['title'])
    
    if foldername in portal_folders:
      exists = True
    
    return exists
dataset/ETHPy150Open Esri/ops-server-config/Publish/Portal/PortalContentPost.py/has_folder/original