<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def check_and_create_directories(paths):
 """ Check and create directories. If the directory is exist, It will remove it and create new folder. :type paths: Array of string or string :param paths: the location of directory """

    for path in paths:
        if os.path.exists(path):
            shutil.rmtree(path)
        os.mkdir(path)