def update(self):
        """Updates the parent_element if it's time to blink. Can safely be
        called often.

        Returns: True if this decorator made a change to the element that has to
            be re-blitted. False if no change.
        """
        current_time = time.time()
        if self.next_action_time <= current_time:
            if self.current_state:
                self.parent_element.opacity = 0
                self.current_state = 0
                self.next_action_time = current_time + self.off_secs

                if self.repeats == 0:
                    self.unload()
                elif self.repeats > 0:
                    self.repeats -= 1

            else:
                self.current_state = 1
                self.next_action_time = current_time + self.on_secs
                self.parent_element.opacity = 255

            return True

        return False

# The MIT License (MIT)

# Copyright (c) 2013-2015 Brian Madden and Gabe Knuth

# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
dataset/ETHPy150Open missionpinball/mpf/mpf/media_controller/decorators/blink.py/Blink.update/original