def METHOD_NAME(path):
    def _cmp(x, y):
        if x[1] and not y[1]:
            return -1
        if not x[1] and y[1]:
            return 1
        if x[0].lower() > y[0].lower():
            return 1
        if x[0].lower() < y[0].lower():
            return -1
        return 0
    items = []
    if path.startswith("~"):
        path = fs.expanduser(path)
    if not os.path.isdir(path):
        return items
    for item in os.listdir(path):
        try:
            item_is_dir = os.path.isdir(os.path.join(path, item))
            if item_is_dir:
                os.listdir(os.path.join(path, item))
            items.append((item, item_is_dir))
        except OSError:
            pass
    return sorted(items, key=cmp_to_key(_cmp))