def parse_timezone(tz_str):
  '''Parse a timezone suffix, as it appears on a date, returning offset in minutes.'''
  try:
    tz_str = tz_str.lower()
    if tz_str[0] in "+-" and len(tz_str) == 5 and tz_str[1:].isdigit():
      sign = 1 if (tz_str[0] == "+") else -1
      hours = int(tz_str[1:3])
      minutes = int(tz_str[3:5])
      return -sign * (60 * hours + minutes)
    elif tz_str == "gmt" or tz_str == "utc":
      return 0
    else:
      return None
  except (ValueError, IndexError):
    return None
dataset/ETHPy150Open bloomreach/zinc/zinc.py/parse_timezone/original