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

        Parameters
        ----------
        output_file : str
            Path to a file where the logs should be written to

        Returns
        -------
        Handle to the opened log file, if necessary. None otherwise
        """
    if not output_file:
        return None
    return open(output_file, 'wb')
