def METHOD_NAME(client, resource_group_name, lab_name, name, source_vm_id, os_type, os_state,
                        author=None, description=None):
    """ Command to create a custom image from a source VM, managed image, or VHD """
    from azure.mgmt.devtestlabs.models import (
        CustomImagePropertiesFromVm, CustomImage, WindowsOsInfo, LinuxOsInfo)
    if source_vm_id is not None:
        payload = CustomImagePropertiesFromVm(
            source_vm_id=source_vm_id,
            windows_os_info=WindowsOsInfo(windows_os_state=os_state) if os_type.lower() == "windows" else None,
            linux_os_info=LinuxOsInfo(linux_os_state=os_state) if os_type.lower() == "linux" else None)
    customImage = CustomImage(
        vm=payload,
        author=author,
        description=description)
    return client.create_or_update(resource_group_name, lab_name, name, customImage)