Try to convert content of README.md into rst format using pypandoc,
    write it into README and return it.

    If pypandoc cannot be imported write content of README.md unchanged into
    README and return it.

def create_readme_with_long_description():
    '''Try to convert content of README.md into rst format using pypandoc,
    write it into README and return it.

    If pypandoc cannot be imported write content of README.md unchanged into
    README and return it.
    '''
    this_dir = os.path.abspath(os.path.dirname(__file__))

    readme_md = os.path.join(this_dir, 'README.md')
    readme = os.path.join(this_dir, 'README')

    if os.path.exists(readme_md):
        # this is the case when running `python setup.py sdist`
        if os.path.exists(readme):
            os.remove(readme)

        try:
            import pypandoc
            long_description = pypandoc.convert(readme_md, 'rst', format='md')
        except(ImportError):
            with open(readme_md, encoding='utf-8') as in_:
                long_description = in_.read()

        with open(readme, 'w') as out:
            out.write(long_description)
    else:
        # this is in case of `pip install fabsetup-x.y.z.tar.gz`
        with open(readme, encoding='utf-8') as in_:
            long_description = in_.read()

    return long_description