Remove a file or directory.

    If path is a directory, this recursively removes the directory and
    any contents. Non-existent paths are silently ignored.

    Supports Unix style globbing by default (disable using
    glob=False). For details on globbing pattern expansion, see:

        https://docs.python.org/2/library/glob.html

    Arguments:
        *components (string[]): path to the file or directory to remove. May be
          absolute or relative. May contain unix glob
        **kwargs: if "glob" is True, perform Unix style pattern expansion of
          paths (default: True).

def rm(*components, **kwargs):
    """
    Remove a file or directory.

    If path is a directory, this recursively removes the directory and
    any contents. Non-existent paths are silently ignored.

    Supports Unix style globbing by default (disable using
    glob=False). For details on globbing pattern expansion, see:

        https://docs.python.org/2/library/glob.html

    Arguments:
        *components (string[]): path to the file or directory to remove. May be
          absolute or relative. May contain unix glob
        **kwargs: if "glob" is True, perform Unix style pattern expansion of
          paths (default: True).
    """
    _path = path(*components)
    glob = kwargs.get("glob", True)
    paths = iglob(_path) if glob else [_path]

    for file in paths:
        if isfile(file):
            os.remove(file)
        elif exists(file):
            shutil.rmtree(file, ignore_errors=False)