def _path_from_name(name, type):
    """
    Expand a 'design/foo' style name to its full path as a list of
    segments.

    >>> _path_from_name("_design/test", '_view')
    ['_design', 'test']
    >>> _path_from_name("design/test", '_view')
    ['_design', 'design', '_view', 'test']
    """
    if name.startswith('_'):
        return name.split('/')
    design, name = name.split('/', 1)
    return ['_design', design, type, name]
