import re


def get_element_bounds(element):
  """Get element bounds.

  Args:
    element: XML element dump from UI.

  Returns:
    element bounds [x1, y1, x2, y2], return [-1, -1, -1, -1] when bounds can't
    be found.
  """
  bounds = element.get("bounds")
  if bounds is None:
    return [-1, -1, -1, -1]
  return list(map(int, re.sub("[^0-9]", " ", bounds).split()))