def short_contests(platforms):
  """Gets all the short contests(less than or equal to 4 hours of duration)"""
  contests_data = get_contests_data()
  active_contests = contests_data["active"]
  upcoming_contests = contests_data["pending"]

  platform_filter = get_platform_filter(platforms)
  get_challenge_duration = lambda x : int(x.split(":")[0]) if "days" not in x else float("inf")
  short_contests = [contest for contest in active_contests
    if get_challenge_duration(contest["duration"]) <= 4 and contest["host_name"] in platform_filter]
  short_contests += [contest for contest in upcoming_contests
    if get_challenge_duration(contest["duration"]) <= 4 and contest["host_name"] in platform_filter]
  return short_contests
dataset/ETHPy150Open architv/chcli/challenges/cli.py/short_contests/original