def plug_parent(plug):
    """Return ``plug`` parent, if it has one, None otherwise.

    Args:
        plug (MPlug): Plug we want the parent of.

    Returns:
        MPlug, None:

    Example:
        >>> modifier = OpenMaya.MDagModifier()
        >>> node = OpenMaya.MFnDagNode(modifier.createNode('transform'))
        >>> modifier = modifier.doIt()
        >>> translate = node.findPlug('translate', False)
        >>> translate_x = node.findPlug('translateX', False)
        >>> plug_parent(translate) == None
        True
        >>> plug_parent(translate_x) == translate
        True
    """
    if plug.isChild:
        return plug.parent()
    elif plug.isElement:
        return plug.array()
    return None