increased verbosity in table.write/table.read errors (fixes issue #590)
This is a rebase / redo based on the IO refactor.  Haven't yet tested
whether _readers and _writers are the right variables; travis will
tell...
Add except clause to catch mysterious socket errors
Add "Raises" section to download_file docs
Merge pull request #1097 from eteq/catch-timeout-socket-errors

Catch timeout socket errors in download_file
Support defining lexers in Python files with a magic coding comment.  This works by using  to get the already decoding source lines rather than opening the source file directly using .
Do the same treatment for magic coding comments on yacc
Adds some tests that caught the bug in #590 and fixed said bug.  Factored out some common functionality into a _get_valid_format internal function, and did a bit of pep-8 cleanup while I was in there.
Merge pull request #1096 from mdboom/misc/ply-unicode-file-patch

PLY parsers don't load on Python 3 when the source file contains Unicode and the locale is ascii
Fix formatting issue of docstring
Merge branch 'verbose_tablewrite_exception'
Fix failure when creating votables

The following code
```
from astropy.io.votable.tree import VOTableFile, Resource, Table, Field
votable = VOTableFile()

resource = Resource()
votable.resources.append(resource)

table = Table(votable)
resource.tables.append(table)
table.fields.extend([Field(votable, name='XXX', datatype="float", unit = "mag")])
```

fails with

```
ERROR: KeyError: 'unit_format' [astropy.io.votable.tree]
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-28-1bdee196c715> in <module>()
----> 1 table.fields.extend([Field(votable, name='XXX', datatype="float", unit = "mag")])

/data/guenther/anaconda/lib/python2.7/site-packages/astropy-0.3.dev4321-py2.7-linux-x86_64.egg/astropy/io/votable/tree.pyc in __init__(self, votable, ID, name, datatype, arraysize, ucd, unit, width, precision, utype, ref, type, id, xtype, config, pos, **extra)
   1152         self.arraysize  = arraysize
   1153         self.ucd        = ucd
-> 1154         self.unit       = unit
   1155         self.width      = width
   1156         self.precision  = precision

/data/guenther/anaconda/lib/python2.7/site-packages/astropy-0.3.dev4321-py2.7-linux-x86_64.egg/astropy/io/votable/tree.pyc in unit(self, unit)
   1323                           self._config, self._pos)
   1324
-> 1325         format = _get_unit_format(self._config)
   1326         if format != default_format:
   1327             unit_obj = u.Unit(

/data/guenther/anaconda/lib/python2.7/site-packages/astropy-0.3.dev4321-py2.7-linux-x86_64.egg/astropy/io/votable/tree.pyc in _get_unit_format(config)
    180     Get the unit format based on the configuration.
    181     """
--> 182     if config['unit_format'] is None:
    183         format = _get_default_unit_format(config)
    184     else:

KeyError: 'unit_format'
```

There is any easy fix for this (and I have implemented it in this pull request); I have also written a unit test.
However, this implementation breaks a different test when reading unrecognized units and I have been unable to figure out why that is.
modified as per suggestion in github discussion
Put astropy.io.votable.writeto in the top-level namespace
Don't use filecmp to compare these files--it gives different results on Windows due to default newlines being different.  Instead just compare the content.
Merge pull request #1102 from hamogu/votabmakeunits

Fix failure when creating votables
Merge pull request #1101 from mdboom/vo/writeto

astropy.io.votable: no write_to method
Merge pull request #1103 from iguananaut/validator-issues

Fix vo.validator tests on Windows
try sphinx build with new wehels