'Create a new path with the given vertices and codes.
Parameters
vertices : array_like
The ``(n, 2)`` float array, masked array or sequence of pairs
representing the vertices of the path.
If *vertices* contains masked values, they will be converted
to NaNs which are then handled correctly by the Agg
PathIterator and other consumers of path data, such as
:meth:`iter_segments`.
codes : {None, array_like}, optional
n-length array integers representing the codes of the path.
If not None, codes must be the same length as vertices.
If None, *vertices* will be treated as a series of line segments.
_interpolation_steps : int, optional
Used as a hint to certain projections, such as Polar, that this
path should be linearly interpolated immediately before drawing.
This attribute is primarily an implementation detail and is not
intended for public use.
closed : bool, optional
If *codes* is None and closed is True, vertices will be treated as
line segments of a closed polygon.
readonly : bool, optional
Makes the path behave in an immutable way and sets the vertices
and codes as read-only arrays.'

def __init__(self, vertices, codes=None, _interpolation_steps=1, closed=False, readonly=False):

    if isinstance(vertices, np.ma.MaskedArray):
        vertices = vertices.astype(float).filled(np.nan)
    else:
        vertices = np.asarray(vertices, float)
    if ((vertices.ndim != 2) or (vertices.shape[1] != 2)):
        msg = u"'vertices'    must    be    a    2D    list    or    array    with    shape    Nx2"
        raise ValueError(msg)
    if (codes is not None):
        codes = np.asarray(codes, self.code_type)
        if ((codes.ndim != 1) or (len(codes) != len(vertices))):
            msg = u"'codes'    must    be    a    1D    list    or    array    with    the    same    length    of    'vertices'"
            raise ValueError(msg)
        if (len(codes) and (codes[0] != self.MOVETO)):
            msg = u"The    first    element    of    'code'    must    be    equal    to    'MOVETO':    {0}"
            raise ValueError(msg.format(self.MOVETO))
    elif closed:
        codes = np.empty(len(vertices), dtype=self.code_type)
        codes[0] = self.MOVETO
        codes[1:(-1)] = self.LINETO
        codes[(-1)] = self.CLOSEPOLY
    self._vertices = vertices
    self._codes = codes
    self._interpolation_steps = _interpolation_steps
    self._update_values()
    if readonly:
        self._vertices.flags.writeable = False
        if (self._codes is not None):
            self._codes.flags.writeable = False
        self._readonly = True
    else:
        self._readonly = False
