'Validate and parse the volume portion of a Flocker configuration.
:param dict configured_volume: The \'volume\' portion of the parsed
application config.
:param unicode application_name: The name of the current application.
:returns ``AttachedVolume`` instance representing the parsed volume.
:raises: ValueError on any parsing error.'

def _parse_volume(self, configured_volume, application_name):

    try:
        maximum_size = configured_volume.pop(u'maximum_size')
    except KeyError:
        maximum_size = None
    except AttributeError:
        raise ValueError((u'Unexpected    value:    ' + str(configured_volume)))
    else:
        try:
            maximum_size = parse_storage_string(maximum_size)
            if (maximum_size < 1):
                raise ValueError(u'Must    be    greater    than    zero.')
        except ValueError as e:
            raise ValueError(u'maximum_size:    {msg}'.format(msg=e.message))
    try:
        mountpoint = configured_volume[u'mountpoint']
    except KeyError:
        raise ValueError(u'Missing    mountpoint.')
    if (not isinstance(mountpoint, (str, unicode))):
        raise ValueError(u'Mountpoint    "{path}"    is    not    a    string.'.format(path=mountpoint))
    try:
        mountpoint.decode(u'ascii')
    except UnicodeError:
        raise ValueError(u'Mountpoint    "{path}"    contains    non-ASCII    (unsupported).'.format(path=mountpoint))
    if (not os.path.isabs(mountpoint)):
        raise ValueError(u'Mountpoint    "{path}"    is    not    an    absolute    path.'.format(path=mountpoint))
    configured_volume.pop(u'mountpoint')
    if (u'dataset_id' in configured_volume):
        dataset_id = configured_volume.pop(u'dataset_id')
    else:
        dataset_id = dataset_id_from_name(application_name)
    if configured_volume:
        raise ValueError(u'Unrecognised    keys:    {keys}.'.format(keys=u',    '.join(sorted(configured_volume.keys()))))
    mountpoint = FilePath(mountpoint)
    volume = AttachedVolume(manifestation=Manifestation(dataset=Dataset(dataset_id=dataset_id, metadata=pmap({u'name': application_name}), maximum_size=maximum_size), primary=True), mountpoint=mountpoint)
    return volume
