def METHOD_NAME(self, activities):
    if not os.path.isdir('/etc/rhsm/facts'):
        if not os.path.exists('/etc/rhsm'):
            # If there's no /etc/rhsm folder just skip it
            return
        os.path.mkdir('/etc/rhsm/facts')
    try:
        with open('/etc/rhsm/facts/leapp.facts', 'w') as f:
            json.dump(_flattened({
                'leapp': [
                    activity for activity in activities
                    if activity.get('activity', '') in ('preupgrade', 'upgrade')]
                }), f, indent=4)
        self._commit_rhsm_facts()
    except OSError:
        # We don't care about failing to 'create' the file here
        # even though it shouldn't though, just ignore it
        pass