<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def SearchTVLibrary(self, showName = None, showID = None, showDir = None):
 """ Search TVLibrary table. If none of the optonal arguments are given it looks up all entries of the table, otherwise it will look up entries which match the given arguments. Note that it only looks up based on one argument - if show directory is given this will be used, otherwise show id will be used if it is given, otherwise show name will be used. Parameters showName : string [optional : default = None] Show name. showID : int [optional : default = None] Show id value. showDir : string [optional : default = None] Show directory name. Returns list or None If no result is found this returns None otherwise it will return a the result of the SQL query as a list. In the case that the result is expected to be unique and multiple entries are return a fatal error will be raised. """

    unique = True
    if showName is None and showID is None and showDir is None:
      goodlogging.Log.Info("DB", "Looking up all items in TV library", verbosity=self.logVerbosity)
      queryString = "SELECT * FROM TVLibrary"
      queryTuple = None
      unique = False
    elif showDir is not None:
      goodlogging.Log.Info("DB", "Looking up from TV library where ShowDir is {0}".format(showDir), verbosity=self.logVerbosity)
      queryString = "SELECT * FROM TVLibrary WHERE ShowDir=?"
      queryTuple = (showDir, )
    elif showID is not None:
      goodlogging.Log.Info("DB", "Looking up from TV library where ShowID is {0}".format(showID), verbosity=self.logVerbosity)
      queryString = "SELECT * FROM TVLibrary WHERE ShowID=?"
      queryTuple = (showID, )
    elif showName is not None:
      goodlogging.Log.Info("DB", "Looking up from TV library where ShowName is {0}".format(showName), verbosity=self.logVerbosity)
      queryString = "SELECT * FROM TVLibrary WHERE ShowName=?"
      queryTuple = (showName, )

    result = self._ActionDatabase(queryString, queryTuple, error = False)

    if result is None:
      return None
    elif len(result) == 0:
      return None
    elif len(result) == 1:
      goodlogging.Log.Info("DB", "Found match in TVLibrary: {0}".format(result), verbosity=self.logVerbosity)
      return result
    elif len(result) > 1:
      if unique is True:
        goodlogging.Log.Fatal("DB", "Database corrupted - multiple matches found in TV Library: {0}".format(result))
      else:
        goodlogging.Log.Info("DB", "Found multiple matches in TVLibrary: {0}".format(result), verbosity=self.logVerbosity)
        return result