def is_directory(bucket, path):
    """
    Return True if the path given is a directory.

    The existence check goes something like this:
        0) for key under consideration foo/bar/
        1) if a zero-length key exists for "foo/bar/", then True.
        2) if a bucket listing with prefix "foo/bar/" returns one or more
           objects, then True.
        3) else False.
    """
    if not path.endswith('/'):
        path = path + '/'
    for key in bucket.list(prefix=path):
        return True
    return False
