@staticmethod
def _setup_log_file(log_file):
    """
        Open a log file if necessary and return the file handle. This will create a file if it does not exist

        :param string log_file: Path to a file where the logs should be written to
        :return: Handle to the opened log file, if necessary. None otherwise
        """
    if not log_file:
        return None
    return open(log_file, 'wb')
