'Create a new volume.
:param size: Size of volume in gigabytes (required)
:type size: ``int``
:param name: Name of the volume to be created
:type name: ``str``
:param location: Which data center to create a volume in. If
empty, undefined behavior will be selected.
(optional)
:type location: :class:`.NodeLocation`
:param snapshot:  Snapshot from which to create the new
volume.  (optional)
:type snapshot:  :class:`.VolumeSnapshot`
:param location: Datacenter in which to create a volume in.
:type location: :class:`.ExEC2AvailabilityZone`
:param ex_volume_type: Type of volume to create.
:type ex_volume_type: ``str``
:param iops: The number of I/O operations per second (IOPS)
that the volume supports. Only used if ex_volume_type
is io1.
:type iops: ``int``
:param ex_encrypted: Specifies whether the volume should be encrypted.
:type ex_encrypted: ``bool``
:param ex_kms_key_id: The full ARN of the AWS Key Management
Service (AWS KMS) customer master key (CMK) to use
when creating the encrypted volume.
Example:
arn:aws:kms:us-east-1:012345678910:key/abcd1234-a123
-456a-a12b-a123b4cd56ef.
Only used if encrypted is set to True.
:type ex_kms_key_id: ``str``
:return: The newly created volume.
:rtype: :class:`StorageVolume`'

def create_volume(self, size, name, location=None, snapshot=None, ex_volume_type='standard', ex_iops=None, ex_encrypted=None, ex_kms_key_id=None):

    params = {'Action': 'CreateVolume', 'Size': str(size)}
    if (ex_volume_type and (ex_volume_type not in VALID_VOLUME_TYPES)):
        raise ValueError(('Invalid    volume    type    specified:    %s' % ex_volume_type))
    if snapshot:
        params['SnapshotId'] = snapshot.id
    if (location is not None):
        params['AvailabilityZone'] = location.availability_zone.name
    if ex_volume_type:
        params['VolumeType'] = ex_volume_type
    if ((ex_volume_type == 'io1') and ex_iops):
        params['Iops'] = ex_iops
    if (ex_encrypted is not None):
        params['Encrypted'] = 1
    if (ex_kms_key_id is not None):
        params['KmsKeyId'] = ex_kms_key_id
    volume = self._to_volume(self.connection.request(self.path, params=params).object, name=name)
    if self.ex_create_tags(volume, {'Name': name}):
        volume.extra['tags']['Name'] = name
    return volume
