code: def _parse_time(self, value):
          
          try:
              # Default time unit is a second, we should convert it to milliseconds.
              return int(value) * 1000
          except ValueError:
              # Try to parse if we are unlucky to cast value into int.
              m = self.time_format.match(value)
              if not m:
                  raise ValueError("Could not parse time represented by '{t}'".format(t=value))
              time = int(m.group('time'))
              if m.group('units') != 'ms':
                  time *= 1000
              return time
docs: Parse string time representation to get number of milliseconds.
          Raises the ``ValueError`` for invalid format.