Center and Scale molecule 2D coordinates.
    This method changes mol coordinates directly to center but not scale.
    This method returns width, height and MLB(median length of bond)
    and scaling will be done by drawer method with these values.

    Returns:
        width: float
        height: float
        mlb: median length of bond

def scale_and_center(mol):
    """Center and Scale molecule 2D coordinates.
    This method changes mol coordinates directly to center but not scale.
    This method returns width, height and MLB(median length of bond)
    and scaling will be done by drawer method with these values.

    Returns:
        width: float
        height: float
        mlb: median length of bond
    """
    cnt = mol.atom_count()
    if cnt < 2:
        mol.size2d = (0, 0, 1)
        mol.descriptors.add("ScaleAndCenter")
        return
    xs = []
    ys = []
    for _, atom in mol.atoms_iter():
        xs.append(atom.coords[0])
        ys.append(atom.coords[1])
    xmin, xmax = (min(xs), max(xs))
    ymin, ymax = (min(ys), max(ys))
    width = xmax - xmin
    height = ymax - ymin
    x_offset = width / 2 + xmin
    y_offset = height / 2 + ymin
    dists = []
    for u, v, _ in mol.bonds_iter():
        dists.append(geometry.distance(mol.atom(u).coords, mol.atom(v).coords))
    try:
        mlb = statistics.median(dists)
    except statistics.StatisticsError:
        # No connection
        mlb = math.sqrt(max([width, height]) / cnt)  # empirical
    if not mlb:  # Many of connected atoms are overlapped
        mol.size2d = (0, 0, 1)
        mol.descriptors.add("ScaleAndCenter")
        return
    # Centering
    for _, atom in mol.atoms_iter():
        atom.coords = (atom.coords[0] - x_offset, atom.coords[1] - y_offset)
    mol.size2d = (width, height, mlb)
    mol.descriptors.add("ScaleAndCenter")