def get_dirs_and_files(key_list, prefix):
    """
    Return a 2-tuple of sets. The first set in the 2-tuple
    contains directory names and the second set contains files names.

    Example with an object_key of /static/. The leading slash from /
    get_dirs_and_files('/static/', ['static/css/ads.css', 'static/js/main.js', 'static/robots.txt'])
    {'css', 'js'} {'robots.txt'}
    """
    dirs = set()
    files = set()
    prefix = prefix.lstrip('/')
    prefix_len = len(prefix)
    for key in key_list:
        if key.startswith(prefix):
            key = key[prefix_len:]
        if '/' in key:
            dirs.add(key.split('/')[0])
        else:
            files.add(key)
    return dirs, files
