Create a new persistent disk. Must specify `disk_name` and `location`,
    and optionally can specify 'disk_type' as pd-standard or pd-ssd, which
    defaults to pd-standard. Can also specify an `image` or `snapshot` but
    if neither of those are specified, a `size` (in GB) is required.

    CLI Example:

    .. code-block:: bash

        salt-cloud -f create_disk gce disk_name=pd size=300 location=us-central1-b

def create_disk(kwargs=None, call=None):

    '''
    Create a new persistent disk. Must specify `disk_name` and `location`,
    and optionally can specify 'disk_type' as pd-standard or pd-ssd, which
    defaults to pd-standard. Can also specify an `image` or `snapshot` but
    if neither of those are specified, a `size` (in GB) is required.

    CLI Example:

    .. code-block:: bash

        salt-cloud -f create_disk gce disk_name=pd size=300 location=us-central1-b
    '''
    if call != 'function':
        raise SaltCloudSystemExit(
            'The create_disk function must be called with -f or --function.'
        )

    if kwargs is None:
        kwargs = {}

    name = kwargs.get('disk_name', None)
    image = kwargs.get('image', None)
    location = kwargs.get('location', None)
    size = kwargs.get('size', None)
    snapshot = kwargs.get('snapshot', None)
    disk_type = kwargs.get('type', 'pd-standard')

    if location is None:
        log.error(
            'A location (zone) must be specified when creating a disk.'
        )
        return False

    if name is None:
        log.error(
            'A disk_name must be specified when creating a disk.'
        )
        return False

    if size is None and image is None and snapshot is None:
        log.error(
            'Must specify image, snapshot, or size.'
        )
        return False

    conn = get_conn()

    location = conn.ex_get_zone(kwargs['location'])
    use_existing = True

    __utils__['cloud.fire_event'](
        'event',
        'create disk',
        'salt/cloud/disk/creating',
        args={
            'name': name,
            'location': location.name,
            'image': image,
            'snapshot': snapshot,
        },
        sock_dir=__opts__['sock_dir'],
        transport=__opts__['transport']
    )

    disk = conn.create_volume(
        size, name, location, snapshot, image, use_existing, disk_type
    )

    __utils__['cloud.fire_event'](
        'event',
        'created disk',
        'salt/cloud/disk/created',
        args={
            'name': name,
            'location': location.name,
            'image': image,
            'snapshot': snapshot,
        },
        sock_dir=__opts__['sock_dir'],
        transport=__opts__['transport']
    )
    return _expand_disk(disk)