def normalized(a, axis=-1, order=2):
    """Return normalized vector for arbitrary axis

    Args
    ----
    a: ndarray (n,3)
        Tri-axial vector data
    axis: int
        Axis index to overwhich to normalize
    order: int
        Order of nomalization to calculate

    Notes
    -----
    This function was adapted from the following StackOverflow answer:
    http://stackoverflow.com/a/21032099/943773
    """
    import numpy
    l2 = numpy.atleast_1d(numpy.linalg.norm(a, order, axis))
    l2[l2 == 0] = 1
    return a / numpy.expand_dims(l2, axis)
