def augment(self, return_batch=False, hooks=None, **kwargs):
assert ia.is_single_bool(return_batch), (<EOL>("<STR_LIT>"<EOL>+ "<STR_LIT>"<EOL>+ "<STR_LIT>") % (str(type(return_batch)),)<EOL>)<EOL>expected_keys = ["<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>"]<EOL>expected_keys_call = ["<STR_LIT:image>"] + expected_keys<EOL>assert any([key in kwargs for key in expected_keys_call]), (<EOL>"<STR_LIT>"<EOL>+ "<STR_LIT>" % (<EOL>"<STR_LIT:U+002CU+0020>".join(expected_keys_call),))<EOL>unknown_args = [key for key in kwargs.keys()<EOL>if key not in expected_keys_call]<EOL>assert len(unknown_args) == <NUM_LIT:0>, (<EOL>"<STR_LIT>" % (<EOL>"<STR_LIT:U+002CU+0020>".join(unknown_args)<EOL>))<EOL>if "<STR_LIT:image>" in kwargs:<EOL><INDENT>assert "<STR_LIT>" not in kwargs, (<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL>images = [kwargs["<STR_LIT:image>"]]<EOL><DEDENT>else:<EOL><INDENT>images = kwargs.get("<STR_LIT>", None)<EOL><DEDENT>order = "<STR_LIT>"<EOL>nb_keys = len(list(kwargs.keys()))<EOL>vinfo = sys.version_info<EOL>is_py36_or_newer = vinfo[<NUM_LIT:0>] > <NUM_LIT:3> or (vinfo[<NUM_LIT:0>] == <NUM_LIT:3> and vinfo[<NUM_LIT:1>] >= <NUM_LIT:6>)<EOL>if is_py36_or_newer:<EOL><INDENT>order = "<STR_LIT>"<EOL><DEDENT>elif not return_batch and nb_keys > <NUM_LIT:2>:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>elif not return_batch and nb_keys == <NUM_LIT:2> and images is None:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>batch = UnnormalizedBatch(<EOL>images=images,<EOL>heatmaps=kwargs.get("<STR_LIT>", None),<EOL>segmentation_maps=kwargs.get("<STR_LIT>", None),<EOL>keypoints=kwargs.get("<STR_LIT>", None),<EOL>bounding_boxes=kwargs.get("<STR_LIT>", None),<EOL>polygons=kwargs.get("<STR_LIT>", None),<EOL>line_strings=kwargs.get("<STR_LIT>", None)<EOL>)<EOL>batch_aug = self.augment_batch(batch, hooks=hooks)<EOL>if return_batch:<EOL><INDENT>return batch_aug<EOL><DEDENT>result = []<EOL>if order == "<STR_LIT>":<EOL><INDENT>for key in kwargs:<EOL><INDENT>if key == "<STR_LIT:image>":<EOL><INDENT>attr = getattr(batch_aug, "<STR_LIT>")<EOL>result.append(attr[<NUM_LIT:0>])<EOL><DEDENT>else:<EOL><INDENT>result.append(getattr(batch_aug, "<STR_LIT>" % (key,)))<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>for key in expected_keys:<EOL><INDENT>if key == "<STR_LIT>" and "<STR_LIT:image>" in kwargs:<EOL><INDENT>attr = getattr(batch_aug, "<STR_LIT>")<EOL>result.append(attr[<NUM_LIT:0>])<EOL><DEDENT>elif key in kwargs:<EOL><INDENT>result.append(getattr(batch_aug, "<STR_LIT>" % (key,)))<EOL><DEDENT><DEDENT><DEDENT>if len(result) == <NUM_LIT:1>:<EOL><INDENT>return result[<NUM_LIT:0>]<EOL><DEDENT>return tuple(result)<EOL>
Augment data.

This method is a wrapper around
``imgaug.augmentables.batches.UnnormalizedBatch`` and
``augment_batch()``. Hence, it supports the same datatypes as
``UnnormalizedBatch``.

If `return_batch` was not set to ``True``, the method will return
a tuple of augmentables. It will return the same types of augmentables
(only augmented) as input into the method. This behaviour
is partly specific to the python version:
  * In _python 3.6+_ (if ``return_batch=False``):
    * Three or more augmentables may be used as input.
    * The return order matches the order of the named arguments, e.g.
      ``B, D, C = augment(B=x, D=y, C=z)``.
    * None of the provided named arguments has to be `image` or `images`.
  * In _python <3.6_  (if ``return_batch=False``):
    * One or two augmentables may be used as input, not more than that.
    * At least one the augmentables has to be `image` or `images`.
    * The augmented images are always returned first.

If `return_batch` was not set to ``False``, an instance of
``UnnormalizedBatch`` will be returned. The output is the same for
all python version and any number or combination of augmentables may
be provided.

All augmentables must be provided as named arguments.
E.g. ``augment(<array>)`` will crash, but ``augment(images=<array>)``
will work.

Parameters
----------
image : None
    or (H,W,C) ndarray \
    or (H,W) ndarray, \
    optional
    The image to augment. Only this or `images` can be set, not both.
    If `return_batch` is ``False`` and the python version is below 3.6,
    either this or `images` _must_ be provided.

images : None \
    or (N,H,W,C) ndarray \
    or (N,H,W) ndarray \
    or iterable of (H,W,C) ndarray \
    or iterable of (H,W) ndarray, \
    optional
    The images to augment. Only this or `image` can be set, not both.
    If `return_batch` is ``False`` and the python version is below 3.6,
    either this or `image` _must_ be provided.

heatmaps : None \
    or (N,H,W,C) ndarray \
    or imgaug.augmentables.heatmaps.HeatmapsOnImage \
    or iterable of (H,W,C) ndarray \
    or iterable of imgaug.augmentables.heatmaps.HeatmapsOnImage, \
    optional
    The heatmaps to augment.
    If anything else than ``HeatmapsOnImage``, then the number of
    heatmaps must match the number of images provided via parameter
    `images`. The number is contained either in ``N`` or the first
    iterable's size.

segmentation_maps : None \
    or (N,H,W) ndarray \
    or imgaug.augmentables.segmaps.SegmentationMapOnImage \
    or iterable of (H,W) ndarray \
    or iterable of imgaug.augmentables.segmaps.SegmentationMapOnImage, \
    optional
    The segmentation maps to augment.
    If anything else than ``SegmentationMapOnImage``, then the number
    of segmaps must match the number of images provided via parameter
    `images`. The number is contained either in ``N`` or the first
    iterable's size.

keypoints : None \
    or list of (N,K,2) ndarray \
    or tuple of number \
    or imgaug.augmentables.kps.Keypoint \
    or iterable of (K,2) ndarray \
    or iterable of tuple of number \
    or iterable of imgaug.augmentables.kps.Keypoint \
    or iterable of imgaug.augmentables.kps.KeypointOnImage \
    or iterable of iterable of tuple of number \
    or iterable of iterable of imgaug.augmentables.kps.Keypoint, \
    optional
    The keypoints to augment.
    If a tuple (or iterable(s) of tuple), then iterpreted as (x,y)
    coordinates and must hence contain two numbers.
    A single tuple represents a single coordinate on one image, an
    iterable of tuples the coordinates on one image and an iterable of
    iterable of tuples the coordinates on several images. Analogous if
    ``Keypoint`` objects are used instead of tuples.
    If an ndarray, then ``N`` denotes the number of images and ``K``
    the number of keypoints on each image.
    If anything else than ``KeypointsOnImage`` is provided, then the
    number of keypoint groups must match the number of images provided
    via parameter `images`. The number is contained e.g. in ``N`` or
    in case of "iterable of iterable of tuples" in the first iterable's
    size.

bounding_boxes : None \
    or (N,B,4) ndarray \
    or tuple of number \
    or imgaug.augmentables.bbs.BoundingBox \
    or imgaug.augmentables.bbs.BoundingBoxesOnImage \
    or iterable of (B,4) ndarray \
    or iterable of tuple of number \
    or iterable of imgaug.augmentables.bbs.BoundingBox \
    or iterable of imgaug.augmentables.bbs.BoundingBoxesOnImage \
    or iterable of iterable of tuple of number \
    or iterable of iterable imgaug.augmentables.bbs.BoundingBox, \
    optional
    The bounding boxes to augment.
    This is analogous to the `keypoints` parameter. However, each
    tuple -- and also the last index in case of arrays -- has size 4,
    denoting the bounding box coordinates ``x1``, ``y1``, ``x2`` and
    ``y2``.

polygons : None  \
    or (N,#polys,#points,2) ndarray \
    or imgaug.augmentables.polys.Polygon \
    or imgaug.augmentables.polys.PolygonsOnImage \
    or iterable of (#polys,#points,2) ndarray \
    or iterable of tuple of number \
    or iterable of imgaug.augmentables.kps.Keypoint \
    or iterable of imgaug.augmentables.polys.Polygon \
    or iterable of imgaug.augmentables.polys.PolygonsOnImage \
    or iterable of iterable of (#points,2) ndarray \
    or iterable of iterable of tuple of number \
    or iterable of iterable of imgaug.augmentables.kps.Keypoint \
    or iterable of iterable of imgaug.augmentables.polys.Polygon \
    or iterable of iterable of iterable of tuple of number \
    or iterable of iterable of iterable of tuple of \
    imgaug.augmentables.kps.Keypoint, \
    optional
    The polygons to augment.
    This is similar to the `keypoints` parameter. However, each polygon
    may be made up of several (x,y) coordinates (three or more are
    required for valid polygons).
    The following datatypes will be interpreted as a single polygon on
    a single image:
      * ``imgaug.augmentables.polys.Polygon``
      * ``iterable of tuple of number``
      * ``iterable of imgaug.augmentables.kps.Keypoint``

    The following datatypes will be interpreted as multiple polygons
    on a single image:
      * ``imgaug.augmentables.polys.PolygonsOnImage``
      * ``iterable of imgaug.augmentables.polys.Polygon``
      * ``iterable of iterable of tuple of number``
      * ``iterable of iterable of imgaug.augmentables.kps.Keypoint``
      * ``iterable of iterable of imgaug.augmentables.polys.Polygon``

    The following datatypes will be interpreted as multiple polygons on
    multiple images:
      * ``(N,#polys,#points,2) ndarray``
      * ``iterable of (#polys,#points,2) ndarray``
      * ``iterable of iterable of (#points,2) ndarray``
      * ``iterable of iterable of iterable of tuple of number``
      * ``iterable of iterable of iterable of tuple of imgaug.augmentables.kps.Keypoint``

line_strings : None \
    or (N,#lines,#points,2) ndarray \
    or imgaug.augmentables.lines.LineString \
    or imgaug.augmentables.lines.LineStringOnImage \
    or iterable of (#polys,#points,2) ndarray \
    or iterable of tuple of number \
    or iterable of imgaug.augmentables.kps.Keypoint \
    or iterable of imgaug.augmentables.lines.LineString \
    or iterable of imgaug.augmentables.lines.LineStringOnImage \
    or iterable of iterable of (#points,2) ndarray \
    or iterable of iterable of tuple of number \
    or iterable of iterable of imgaug.augmentables.kps.Keypoint \
    or iterable of iterable of imgaug.augmentables.lines.LineString \
    or iterable of iterable of iterable of tuple of number \
    or iterable of iterable of iterable of tuple of \
    imgaug.augmentables.kps.Keypoint, \
    optional
    The line strings to augment.
    See `polygons`, which behaves similarly.

return_batch : bool, optional
    Whether to return an instance of
    `imgaug.augmentables.batches.UnnormalizedBatch`. If the python
    version is below 3.6 and more than two augmentables were provided
    (e.g. images, keypoints and polygons), then this must be set to
    ``True``. Otherwise an error will be raised.

hooks : None or imgaug.imgaug.HooksImages, optional
    Hooks object to dynamically interfere with the augmentation process.

Returns
-------
tuple or imgaug.augmentables.batches.UnnormalizedBatch
    If `return_batch` was set to ``True``, a instance of
    ``UnnormalizedBatch`` will be returned.
    If `return_batch` was set to ``False``, a tuple of augmentables
    will be returned, e.g. ``(augmented images, augmented keypoints)``.
    The datatypes match the input datatypes of the corresponding named
    arguments. In python <3.6, augmented images are always the first
    entry in the returned tuple. In python 3.6+ the order matches the
    order of the named arguments.

Examples
--------
>>> import numpy as np
>>> import imgaug as ia
>>> import imgaug.augmenters as iaa
>>> aug = iaa.Affine(rotate=(-25, 25))
>>> image = np.zeros((64, 64, 3), dtype=np.uint8)
>>> keypoints = [(10, 20), (30, 32)]  # (x,y) coordinates
>>> images_aug, keypoints_aug = aug.augment(
>>>     image=image, keypoints=keypoints)

This creates a single image and a set of two keypoints on it, then
augments both by applying a random rotation between -25deg and +25deg.
The sampled rotation value is automatically aligned between image and
keypoints. Note that in python <3.6, augmented images will always be
returned first, independent of the order of the named input arguments.
So ``keypoints_aug, images_aug = aug.augment(keypoints=keypoints,
image=image)`` would _not_ work (except in python 3.6+).

>>> import numpy as np
>>> import imgaug as ia
>>> import imgaug.augmenters as iaa
>>> aug = iaa.Affine(rotate=(-25, 25))
>>> images = [np.zeros((64, 64, 3), dtype=np.uint8),
>>>           np.zeros((32, 32, 3), dtype=np.uint8)]
>>> keypoints = [[(10, 20), (30, 32)],  # KPs on first image
>>>              [(22, 10), (12, 14)]]  # KPs on second image
>>> bbs = [
>>>           [ia.BoundingBox(x1=5, y1=5, x2=50, y2=45)],
>>>           [ia.BoundingBox(x1=4, y1=6, x2=10, y2=15),
>>>            ia.BoundingBox(x1=8, y1=9, x2=16, y2=30)]
>>>       ]  # one BB on first image, two BBs on second image
>>> batch_aug = aug.augment(
>>>     images=images, keypoints=keypoints, bounding_boxes=bbs,
>>>     return_batch=True)

This creates two images of size 64x64 and 32x32, two sets of keypoints
(each containing two keypoints) and two sets of bounding boxes (the
first containing one bounding box, the second two bounding boxes).
These augmentables are then augmented by applying random rotations
between -25deg and +25deg to them. The rotation values are sampled
by image and aligned between all augmentables on the same image.
The method finally returns an instance of ``UnnormalizedBatch`` from
which the augmented data can be retrieved via ``batch_aug.images_aug``,
``batch_aug.keypoints_aug``, and ``batch_aug.bounding_boxes_aug``.
In python 3.6+, `return_batch` can be kept at ``False`` and the
augmented data can be retrieved as
``images_aug, keypoints_aug, bbs_aug = augment(...)``.