def calc_bounds(conformer):
    """
    Calculate the X,Y bounds of a molecule, the minimum and maximum X and Y coordinates of any atom in the molecule.
    It is assumed that the molecule already has 2D coordinates.

    :param mol:
    :return: X and Y bounds as lists of length 2
    """
    x = [0, 0]
    y = [0, 0]
    num = conformer.GetOwningMol().GetNumAtoms()
    for i in range(num):
        pos = conformer.GetAtomPosition(i)
        if pos.x < x[0]:
            x[0] = pos.x
        if pos.x > x[1]:
            x[1] = pos.x
        if pos.y < y[0]:
            y[0] = pos.y
        if pos.y > y[1]:
            y[1] = pos.y
    return x, y