def find_uptime_field(a_pattern, uptime_str):
 a_check = re.search(a_pattern, uptime_str)
 if a_check:
  return int(a_check.group(1))
 else:
  return 0

def find_uptime_field ( a_pattern , uptime_str ) : a_check = re . search ( a_pattern , uptime_str ) if a_check : return int ( a_check . group ( 1 ) ) else : return 0
if there is a match return the match group(1) else return 0 .