import math


def point_distance(p1, p2, squared=False):
    """ Calculate the squared eucliden distance of two points.

    Parameters
    ----------
    p1 : associative array $p1 first point
    p2 : associative array $p2 second point

    Returns
    -------
    float

    Examples
    --------
    >>> point_distance({'x': 0, 'y': 0}, {'x': 3, 'y': 4})
    5.0
    >>> '%.2f' % point_distance({'x': 0, 'y': 0}, {'x': 1, 'y': 22})
    '22.02'
    """
    dx = p1["x"] - p2["x"]
    dy = p1["y"] - p2["y"]
    if squared:
        return (dx*dx + dy*dy)
    else:
        return math.sqrt(dx*dx + dy*dy)