def mkp(*args, **kwargs):
mk = kwargs.pop('<STR_LIT>', False)<EOL>path = os.sep.join(list(args))<EOL>if mk:<EOL><INDENT>while sep2 in path:<EOL><INDENT>path = path.replace(sep2, os.sep)<EOL><DEDENT>try:<EOL><INDENT>os.makedirs(path)<EOL><DEDENT>except FileExistsError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>return path<EOL>
Generate a directory path, and create it if requested.

.. code-block:: Python

    filepath = mkp('base', 'folder', 'file')
    dirpath = mkp('root', 'path', 'folder', mk=True)

Args:
    \*args: File or directory path segments to be concatenated
    mk (bool): Make the directory (if it doesn't exist)

Returns:
    path (str): File or directory path