from datetime import datetime
import re
import os

# DATETIME
def convWebTimeStrToDatetime(timeStr):
    return datetime.strptime(timeStr,"%d %b %Y, %H:%M")

def convInputStrToDatetime(timeStr):
    return datetime.strptime(timeStr,"%Y-%m-%d %H:%M:%S")

def convTimeToStr(dateT):
    return datetime.strftime(dateT,"%Y-%m-%d_%H-%M-%S")

def convTimeToMonthYearStr(dateT):
    return datetime.strftime(dateT,"%Y-%m")

def getCurrDateStr():
    return datetime.strftime(datetime.now(), "%Y-%m-%d")

# STRING
def cleanseStr(x):
    # Swap whitespaces with underscores
    x = re.sub(r'(\s+)', '_', x)
    # Filter only alphanumeric and underscores
    x = re.sub(r'[^\w+]', '', x)
    return x

# OS
def safeCreateDir(relPath):
    """Will create a dir if doesnt exist yet"""
    if not os.path.isdir(relPath):
        os.mkdir(relPath)
36dfd10265bdb89736e99df069448d82ec2aaf8b
<mask token>


def convWebTimeStrToDatetime(timeStr):
    return datetime.strptime(timeStr, '%d %b %Y, %H:%M')


<mask token>


def convTimeToMonthYearStr(dateT):
    return datetime.strftime(dateT, '%Y-%m')


def getCurrDateStr():
    return datetime.strftime(datetime.now(), '%Y-%m-%d')


<mask token>


def safeCreateDir(relPath):
    """Will create a dir if doesnt exist yet"""
    if not os.path.isdir(relPath):
        os.mkdir(relPath)

<mask token>


def convWebTimeStrToDatetime(timeStr):
    return datetime.strptime(timeStr, '%d %b %Y, %H:%M')


def convInputStrToDatetime(timeStr):
    return datetime.strptime(timeStr, '%Y-%m-%d %H:%M:%S')


def convTimeToStr(dateT):
    return datetime.strftime(dateT, '%Y-%m-%d_%H-%M-%S')


def convTimeToMonthYearStr(dateT):
    return datetime.strftime(dateT, '%Y-%m')


def getCurrDateStr():
    return datetime.strftime(datetime.now(), '%Y-%m-%d')


<mask token>


def safeCreateDir(relPath):
    """Will create a dir if doesnt exist yet"""
    if not os.path.isdir(relPath):
        os.mkdir(relPath)

<mask token>


def convWebTimeStrToDatetime(timeStr):
    return datetime.strptime(timeStr, '%d %b %Y, %H:%M')


def convInputStrToDatetime(timeStr):
    return datetime.strptime(timeStr, '%Y-%m-%d %H:%M:%S')


def convTimeToStr(dateT):
    return datetime.strftime(dateT, '%Y-%m-%d_%H-%M-%S')


def convTimeToMonthYearStr(dateT):
    return datetime.strftime(dateT, '%Y-%m')


def getCurrDateStr():
    return datetime.strftime(datetime.now(), '%Y-%m-%d')


def cleanseStr(x):
    x = re.sub('(\\s+)', '_', x)
    x = re.sub('[^\\w+]', '', x)
    return x


def safeCreateDir(relPath):
    """Will create a dir if doesnt exist yet"""
    if not os.path.isdir(relPath):
        os.mkdir(relPath)

from datetime import datetime
import re
import os


def convWebTimeStrToDatetime(timeStr):
    return datetime.strptime(timeStr, '%d %b %Y, %H:%M')


def convInputStrToDatetime(timeStr):
    return datetime.strptime(timeStr, '%Y-%m-%d %H:%M:%S')


def convTimeToStr(dateT):
    return datetime.strftime(dateT, '%Y-%m-%d_%H-%M-%S')


def convTimeToMonthYearStr(dateT):
    return datetime.strftime(dateT, '%Y-%m')


def getCurrDateStr():
    return datetime.strftime(datetime.now(), '%Y-%m-%d')


def cleanseStr(x):
    x = re.sub('(\\s+)', '_', x)
    x = re.sub('[^\\w+]', '', x)
    return x


def safeCreateDir(relPath):
    """Will create a dir if doesnt exist yet"""
    if not os.path.isdir(relPath):
        os.mkdir(relPath)

from datetime import datetime
import re
import os

# DATETIME
def convWebTimeStrToDatetime(timeStr):
    return datetime.strptime(timeStr,"%d %b %Y, %H:%M")

def convInputStrToDatetime(timeStr):
    return datetime.strptime(timeStr,"%Y-%m-%d %H:%M:%S")

def convTimeToStr(dateT):
    return datetime.strftime(dateT,"%Y-%m-%d_%H-%M-%S")

def convTimeToMonthYearStr(dateT):
    return datetime.strftime(dateT,"%Y-%m")

def getCurrDateStr():
    return datetime.strftime(datetime.now(), "%Y-%m-%d")

# STRING
def cleanseStr(x):
    # Swap whitespaces with underscores
    x = re.sub(r'(\s+)', '_', x)
    # Filter only alphanumeric and underscores
    x = re.sub(r'[^\w+]', '', x)
    return x

# OS
def safeCreateDir(relPath):
    """Will create a dir if doesnt exist yet"""
    if not os.path.isdir(relPath):
        os.mkdir(relPath)