def prody_select(selstr, *pdbs, **kwargs):
    """Write selected atoms from a PDB file in PDB format.

    :arg selstr: atom selection string, see :ref:`selections`

    :arg pdbs: PDB identifier(s) or filename(s)

    :arg output: output filename, default is :file:`pdb_selected.pdb`

    :arg prefix: prefix for output file, default is PDB filename

    :arg suffix: output filename suffix, default is :file:`_selected`"""
    from os.path import isfile
    from prody import LOGGER, parsePDB, writePDB
    if not pdbs:
        raise ValueError('pdb argument must be provided')
    if (isfile(selstr) or len(selstr) == 4 and selstr[0].isdigit()) and len(
        pdbs) == 1 and not isfile(pdbs[0]):
        pdbs, selstr = selstr, pdbs[0]
        LOGGER.warn(
            'The order of selstr and pdb arguments have switched to support multiple files, old order will be supported until v1.4.'
            )
        pdbs = [pdbs]
    prefix = kwargs.get('prefix', None)
    suffix = kwargs.get('suffix', '_selected')
    output = kwargs.get('output', None)
    for pdb in pdbs:
        pdb = parsePDB(pdb)
        pdbselect = pdb.select(selstr)
        if pdbselect is None:
            LOGGER.warn('Selection {0} did not match any atoms.'.format(
                repr(selstr)))
            return
        LOGGER.info('Selection {0} matched {1} atoms.'.format(repr(selstr),
            len(pdbselect)))
        outname = output or (prefix or pdb.getTitle()) + suffix
        LOGGER.info('Selection is written into: ' + writePDB(outname,
            pdbselect))
