I have in this class bellow, a method that gets the date from a file according to the name of the client. For each client, the method to extract the date is different. I want to use heritage or any other way to have a generic class without conditions, by putting all the specific code in somewhere else. I tried to create a class for each client then make the class Parser inherits from all the clients, but it is still not well structured.import sysimport osimport reimport fnmatchimport csvimport pandas as pdimport numpy as npfrom dateutil.parser import parse as parseDatefrom datetime import datetime, time, timedeltaclass Parser():    def get_dateFromfile(self, file = None):        Datefile = None        if CLIENT == C1:            Datefile = parseDate(conf.WORKDIR[-14:])        elif CLIENT == C2 and file:            patternToFindDate = 20H-0H45            filename = os.path.splitext(os.path.basename(file))[0]            Datefile = parseDate(filename[filename.find(patternToFindDate) + len(patternToFindDate):], dayfirst=True)        elif CLIENT == C3 and file:            filename = os.path.splitext(os.path.basename(file))[0]            Datefile = parseDate(filename.rsplit('_', 1)[1])        elif CLIENT == C4 and file:            filename = os.path.splitext(os.path.basename(file))[0]            timestamp = filename[-14:]            date = timestamp[:8].replace(., -) +   + timestamp[-5:].replace(., :)            Datefile = parseDate(date, yearfirst=True)        elif CLIENT==C5 and file:            filename = os.path.splitext(os.path.basename(file))[0]            timestamp = filename[-19:]            date = timestamp[:10] +   + timestamp[-8:].replace(-,:)            Datefile = parseDate(date)The method of the class has as an input an CSV file. the name of this file contains a date, and the format of the date changes according to the client. the output of the function is a string : a date in the format YYYYMMDDHHmmss. I will try all your suggestions.Any better idea ? 
Method that gets the date from a file according to the name of the client
python;parsing;datetime